Detected resolved migration not applied to database on flyway
The migration option outOfOrder
is your friend here. Set it to true to allow inserting those migrations after the fact.
On the command line, run:
flyway -outOfOrder=true migrate
Or if you use the Maven plugin:
mvn -Dflyway.outOfOrder=true flyway:migrate
I faced similar problem when switching from one git branch to another and tried to runflyway:migrate
.For example when I was on branch 'release_4.6.0' I didn't have migrations on my local machine from branch 'release_4.7.0' soI received next errorFlywayException: Validate failed: Detected applied migration not resolved locally
.The solution that worked for me is to set ignoreMissingMigrations
flyway option to true.In maven it looks like
flyway:migrate -Dflyway.ignoreMissingMigrations=true
Maybe it's not an answer for this question, but it can be helpful for those who faced the same problem as me.
Here you can find more details:https://flywaydb.org/documentation/configuration/parameters/ignoreMissingMigrations