It seems that all migrations run in a single transaction (https://github.com/typeorm/typeorm/blob/master/src/migration/MigrationExecutor.ts). This can cause issues, for example:
CREATE INDEX CONCURRENTLY (PostgreSQL), to add an index to that table outside of the current transaction, using the workaround described in https://github.com/typeorm/typeorm/issues/1169.Expected result: Migrations succeed.
Actual result: Fails because the transaction that creates the table in the first migration _is still open and uncommitted_ when the second migration runs.
Unless there is a reason to use a single transaction for all migrations, I suggest using a separate transaction per migration, which should fix this issue.
Fixed in the latest @next.
Now you can specify an option to the migration:run command and disable transaction:
migration:run -t=false
You can try it via npm i typeorm@next.
Most helpful comment
Fixed in the latest
@next.Now you can specify an option to the
migration:runcommand and disable transaction:You can try it via
npm i typeorm@next.