How do I create indexes concurrently with flyway in postgres?

flyway, postgresql

Solution

Not at this point. All migrations currently run within a transaction. Feel free to file an enhancement request in the issue tracker.

Problem

Postgres allows the creation of indexes without locking the table using the CONCURRENTLY option. This options is not allowed in a transaction, so when it is added to a flyway migration script flyway fails: ERROR: Caused by org.postgresql.util.PSQLException: ERROR: CREATE INDEX CONCURRENTLY cannot run inside a transaction block ActiveRecord supports the disable_ddl_transaction! to address this scenario. Does flyway support some way to run such a script outside of a transaction?

Original source

Related problems