View Source BlitzCredoChecks.ConcurrentIndexMigrations (BlitzCredoChecks v0.1.6)

Indexes need to be created and dropped concurrently in order to prevent locking the table in production

Add these module attributes to your migration file:

@disable_ddl_transaction true @disable_migration_lock true

And add to the opts of your create/drop index function:

concurrently: true

If this is a partitioned table you need to create the index for every partition individually and then do one non-concurrent index build for the whole table. This final build will be much faster as it will just consolidate the individual indexes.

Add this above that non-concurrent index:

credo:disable-for-next-line BlitzCredoChecks.ConcurrentIndexMigrations