In migrate.ts, we skipped creating transaction outputs table if the schema exists. However, it's possible that the schema exists but the table doesn't. So we have to move table creation out of schema existence check.
In both migrate.ts and user_database.ts, always check if a schema/table/index exists before running CREATE IF NOT EXISTS queries. The reason is that those DDL queries would hold locks and we don't want to always lock the table when we start a Transact program.
This PR fixes two issues:
CREATE IF NOT EXISTS
queries. The reason is that those DDL queries would hold locks and we don't want to always lock the table when we start a Transact program.