Search code examples
spring-bootdatabase-migrationflyway

Flyway out of order migration


Imagine I have the following flyway migrations:

  • V1__create_table.sql
  • V2__create_table.sql
  • V4__create_table.sql

And these migrations have been applied to my database. Is there a possibility to add the following script:

  • V3__create_table.sql

And let flyway run this migration out of order without complaining?


Solution

  • Flyway 2 has flyway.outOfOrder property which is by default false You would have to set it to true to run your missing migration, as per migrate docs:

    Allows migrations to be run "out of order".

    If you already have versions 1 and 3 applied, and now a version 2 is found, it will be applied too instead of being ignored.