Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flyway 3.0 Migration Checksum mismatch

Tags:

maven

flyway

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?

like image 815
bbcooper Avatar asked May 21 '14 07:05

bbcooper


People also ask

What checksum does Flyway use?

Flyway uses the CRC32 algorithm for checksum generation.

How does Flyway checksum work?

Checksum field in Flyway forming a part of verification mechanism ensuring that migration scripts haven't been changed since they applied to the database. This will guaranty that all instances of your application will have same database structure (content).


1 Answers

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

like image 69
Axel Fontaine Avatar answered Sep 28 '22 02:09

Axel Fontaine