database-migrationflywaydata-migrationschema-migration

Run Flyway Migration Asynchronously


By design the flyway migrations run in transactions and synchronously pretty early during startup of an application. This is usually desired, to ensure before business logic starts to execute the database is in a consistent state (migrated) or the migration fails and the app crashes.

In some cases I'd really like to be able to start the application without it waiting for some migrations to be completed (long running migrations, creating indexes or materialized views, etc.). This might also be needed when deploying from a CI-Server and using deploy-timeouts / health-checks (that can not be raised indefinitely) to ensure the deployment worked as expected.

Is there any configuration / convention / best practice to enable async migrations?
(i.e. naming the migration A2_00__UpdateSthLong.sql instead of V2 (standard) or R2 (Repeatable migration).


Solution

  • Seems like its not possible (yet):