-
Notifications
You must be signed in to change notification settings - Fork 64
Description
I have a .sql migration file, and added the desired header:
`-- postgres-migrations disable-transaction
-- The disable transaction is to allow 'concurrently' to be used.
-- Up migration
CREATE INDEX CONCURRENTLY IF NOT EXISTS my_index_name_columns
ON table (column1, column2, column3)
WHERE deleted_at IS NULL;`
However, when I run the migration, despite it acknowledging transaction:false, it still gives the error shown:
{"label":"pgMigrate","level":"info","message":"Starting migration: 232 add-table-indexes","timestamp":"2025-11-26T23:16:16.002Z"} {"label":"pgMigrate","level":"info","message":"Running migration in transaction: false","timestamp":"2025-11-26T23:16:16.002Z"} {"label":"pgMigrate","level":"info","message":"Error while using lock: Migration failed. Reason: An error occurred running 'add-table-indexes'. Rolled back this migration. No further migrations were run. Reason: CREATE INDEX CONCURRENTLY cannot run inside a transaction block","timestamp":"2025-11-26T23:16:16.061Z"} {"label":"pgMigrate","level":"info","message":"Releasing advisory lock...","timestamp":"2025-11-26T23:16:16.061Z"} {"label":"pgMigrate","level":"info","message":"... released advisory lock","timestamp":"2025-11-26T23:16:16.122Z"} Error running migrations Error: Migration failed. Reason: An error occurred running 'add-table-indexes'. Rolled back this migration. No further migrations were run. Reason: CREATE INDEX CONCURRENTLY cannot run inside a transaction block at /usr/src/app/node_modules/postgres-migrations/dist/migrate.js:100:27