Run Flyway in repair mode

Flyway migration error

Reason: Sometimes developers need to change old SQL scripts. These can scripts were pushed in repository days/months/years ago. Flyway detects scripts that were already applied in databases of OpenIAM but after were changed in repository. Good news! Flyway can fix itself; you just need to give it proper command to start. Highly possible situation when you are using "dev" or "qa" tags.

Example of error in flyway container:

ERROR: Validate failed: Migrations have failed validation
Migration checksum mismatch for migration version
-> Applied to database : 938263552
-> Resolved locally : 726554884. Either revert the changes to the migration, or run repair to update the schema history.

To fix it follow instruction:

  1. Remove flyway from docker stack by command: docker stack rm flyway
  2. Open compose file 3.2/utilities/flyway/docker-compose.yaml
  3. Add in environment section: FLYWAY_COMMAND: "repair"
  4. Run ./
  5. When script completed check Flyway container log. use flag -a to see finished containers: docker ps -a | grep flyway
  6. Error in Flyway container should be gone now
  7. Comment line FLYWAY_COMMAND: "repair" in3.2/utilities/flyway/docker-compose.yaml
  8. Remove flyway from docker stack by command: docker stack rm flyway
  9. Run ./ again
  10. If the same error appears again in next updates, repeat these steps.