0

I have a spring boot application. Because of an upgrade I must update the migration files to make them compatible to the new version. This leads to hash mismatch and the application does not start. Locally I can fix it by running

mvn flyway:repair

However, in the servers the applications run in a tomcat, so I cannot execute those maven targets.

Is there another way to execute the flyway repair in an application running in tomcat?

Dimitris
  • 560
  • 3
  • 17

1 Answers1

1

A similar question was answered here. https://stackoverflow.com/a/38577633/16398766

In short though, you create a FlywayMigrationStrategy bean in Spring to run the flyway.repair() method before your migrations.

Barry
  • 369
  • 1
  • 6
  • Won't that fail on the start up with hash mismatch? I presumed that the code execution, happens after the migrations. – Dimitris Jun 05 '23 at 08:32
  • I will try it, if it works my question is a duplicate indeed. – Dimitris Jun 05 '23 at 08:33
  • If you create your own FlywayMigrationStrategy it overrides the one created by spring boot. So if you do flyway.repair() then flyway.migrate() in the method then it'll happen in that order. – Barry Jun 27 '23 at 08:56