Validate failed: Detected applied migration not resolved locally | Flyway
Solution 1
you can fix your issue by executing this command in your local db.
delete from flyway_schema_history where version = '1.5.4'
Solution 2
I've met this problem when deploy release branch which cherry pick some commit from master.
I've fixed this by add properties:
spring:
flyway:
ignore-missing-migrations: true
Please refer to https://flywaydb.org/documentation/configuration/parameters/ignoreMissingMigrations and https://flywaydb.org/documentation/configuration/parameters/outOfOrder.
You can add outOfOrder option to migrate old version sql script at the next cherry-pick (which cherry pick the older commits):
spring:
flyway:
ignore-missing-migrations: true
out-of-order: true
Solution 3
If you are using a configuration file, try to use this:
flyway.outOfOrder=true
flyway.ignoreMissingMigrations=true
Harsh
Updated on June 27, 2022Comments
-
Harsh almost 2 years
While setting up flyway i am getting this error in my spring-boot app
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Detected applied migration not resolved locally: 1.5.4
properties file
spring.jpa.hibernate.ddl_auto=update spring.jpa.hibernate.use-new-id-generator-mappings=false spring.flyway.locations=classpath:db/migration,classpath:db/vendor/mysql spring.flyway.baseline-on-migrate=true spring.flyway.baseline-version=1.0.2 spring.flyway.table=schema_version spring.flyway.enabled=true
The above configuration is working fine with other project.
i tried adding this plugin in my pom.xml but still its not working
<plugin> <groupId>org.flywaydb</groupId> <artifactId>flyway-maven-plugin</artifactId> <configuration> <argline>${argline} flyway:migrate -Dflyway.ignoreMissingMigrations=true</argline> </configuration> </plugin>