I am getting the following warning message in my logs when outOfOrder
is set to true:
WARNING: outOfOrder mode is active. Migration run may not be reproducible.
What is the exact meaning of this message? It will be good if someone can tell me what would happen when migration happens. Any example would be helpful.
Description. Allows migrations to be run “out of order”. If you already have versions 1.0 and 3.0 applied, and now a version 2.0 is found, it will be applied too instead of being ignored.
Cause: The code is missing a migration script that was previously applied to the database. This can happen when multiple people are creating Flyway migrations at the same time. In that case, update your code, so it includes the migration script specified in the error message.
flyway.outOfOrder - Out Of Order - Flyway by Redgate • Database Migrations Made Easy. Allows migrations to be run “out of order”. If you already have versions 1.0 and 3.0 applied, and now a version 2.0 is found, it will be applied too instead of being ignored.
To preserve the state of the database schema, flyway creates and stores metadata about all applied schema migration in an own table (see picture below). The table shows in which order, which script has been applied and when.
To allow executing this migration, set -outOfOrder=true This can happen when multiple people are creating Flyway migrations at the same time, since by default, Flyway expects the migrations to be applied in order according to the version number. Let’s say you worked on migration version 2.0 and applied it to the database.
Assume 3 migrations:
Running with outOfOrder may result in say your migrations applied like this:
1, 3, 2 -> In the DB: TOM, JERRY, Mickey
Re-running it later will produce
1, 2, 3 -> In the DB: TOM, JERRY, MICKEY
This is why outOfOrder is potentially dangerous and the first migration run might not be reproducible.
To add to Axel's answer, not only may the resulting data vary depending on the order, but the migration may not even be possible. Consider:
Migrations:
foo
foo.bar
foo.bar
to foo.baz
Execution order:
foo
has column baz
foo.bar
not foundfoo
not foundfoo
not foundIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With