Phil Horder
Phil Horder

Reputation: 421

Flyway does not ignore out of order migration scripts, with outOfOrder=false

I am not using outOfOrder. I would like to be able to add a migration script, that would not be the latest, (e.g. to bugfix an existing script, without changing that script).

I would like the new script to be run, as part of the normal ordering, on databases that haven't been migrated yet. Any databases that are up to date (e.g. manually repaired) should ignore the new script.

From the documentation:

OutOfOrder - 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.

This suggests that the new script will be ignored, but I get the error:

ERROR: Validate failed: Detected resolved migration not applied to database

Will the new script only be ignored if the db baseline is ahead of it? Is this the expected behaviour?

If so, I guess my solution here is either to:

Upvotes: 1

Views: 3797

Answers (1)

Axel Fontaine
Axel Fontaine

Reputation: 35169

There is a pull request for this that will be merged in time for Flyway 5.1.0: https://github.com/flyway/flyway/pull/1866

Until then you also have the option to disable validation by setting validateOnMigrate to false.

Upvotes: 1

Related Questions