Flyway 3.0 Migration Checksum mismatch

Solution 1:

Flyway 3.0 changed the default of validateOnMigrate to true.

This is however a good thing, as in the spirit of fail fast, errors are discovered sooner.

In your case some scripts did change since they were applied, which is what Flyway is reporting.

You have two options:

  • suppress the error by setting validateOnMigrate to false (2.3 default behavior)
  • invoke Flyway.repair() to reallign the checksums

Reference
Flyway Repair

Solution 2:

To add to Axel Fontaine's answer:

I was able to use mvn flyway:repair but I had to point the flyway.locations config property at the folder that contains my db migration scripts. Otherwise I would get the message "Repair of metadata table xyz.schema_version not necessary. No failed migration detected." like other folks mentioned.

I used mvn -Dflyway.locations=filesystem:<project dir>/src/main/resources/db/migrations flyway:repair and I saw the checksum updated in the metadata table, fixing my problem.