Search code examples
mavenflyway

Flyway 3.0 Migration Checksum mismatch


after upgrading Flyway Maven plugin from 2.3 to 3.0 I get:

[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:3.0:migrate (default-cli) on project xxx: org.flywaydb.core.api.FlywayException: Validate failed. Found differences between applied migrations and available migrations: Migration Checksum mismatch for migration V003__data_feed_sources_locations.sql: DB=942424992, Classpath=1117634405 -> [Help 1]

Got a similar error on some other project.

If I downgrade back to 2.3 the migration runs ok. Does this has something to do with different platform encoding for calculating checksums?

Any workaround, or better yet, proper solution?


Solution

  • 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