Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validate failed: Detected applied migration not resolved locally | Flyway

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>
like image 878
Harsh Avatar asked Oct 31 '19 09:10

Harsh


People also ask

What is Flyway validate?

Validate helps you verify that the migrations applied to the database match the ones available locally. This is very useful to detect accidental changes that may prevent you from reliably recreating the schema. Validate works by storing a checksum (CRC32 for SQL migrations) when a migration is executed.

Which is better Flyway or Liquibase?

While both tools are based on Martin Fowler's Evolutionary Database, there are many differences in what these tools offer. Here's where Liquibase and Flyway differ. The bottom line is that Liquibase is more powerful and flexible — covering more database change and deployment use cases than Flyway.

What does Flyway baseline do?

In Flyway, a baseline is simply an entry in the history table, with a version that tells Flyway the point from which to start all subsequent migrations. The baselining process doesn't create any scripts or other files in the Scripts directory.


1 Answers

you can fix your issue by executing this command in your local db.

delete from flyway_schema_history where version = '1.5.4'
like image 123
umar uran uulu Avatar answered Oct 11 '22 06:10

umar uran uulu