0

Our team uses Flyway SQL migrations in our current project, storing all the codebase in Git. To code, each member uses either Eclipse or Intelij Idea, someone uses Linux while others Windows. It happened several times that the SQL migration file has been inadvertently modified. Probably the main scenario is for a developer to run a "reformat code" across the whole project and this in turn slightly changes the SQL, removing an empty line, splitting a SQL line and stuff like that, so changing the file without changing the logic validity of the SQL instructions. The problem is when we deploy the new version of the application, it fails to start up because Flyway notes that the checksum of the migration files included in the applications differs from the ones stored in the flyway tables.

I ask you for proposals about how to avoid this problem caused by "failing" migrations.

We thought about the SQL files to be immutable so that checksum cannot change. Or at least that the build process should warn us in case the file changed. But we did not come out with any satisfying solution.

Thanks in advance for your help.

danidemi
  • 4,404
  • 4
  • 34
  • 40

0 Answers0