2
votes

I updated from Spring Boot 1.5 to 2. As some other, I also faced the issue that by doing the update also Flyway was updated from 3 to 5. The problem with the Flyway update is that the flyway schema table does not get migrated automatically so that the database migrations do not work.

The Spring Boot migration guide suggests to update first to Flyway 4 and then do the update to Spring Boot 2. I did as suggested and included

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.2.RELEASE</version>
</parent>
<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
    <version>4.0</version>
</dependency>

into my POM. Flyway stated that you just need to run the application to apply the migration from version 3 to 4. When I start the application everything works (no error) BUT the schema table of Flyway was NOT migrated. I still see the columns in there which should be removed by the migration (version_rank).

My question now: What do I need to do to trigger the Flyway migration?

Update: Thanks to @M. Deinum! His comment gave me the hint to fix the issue. If you face a similar problem: search through your workspace if you do something with flyway that would bypass Spring Boot auto config.

1
As stated, quite explicitly, in the documentation you should upgrade to 4.2.0 you are using 4.0. Basically you upgraded to a too low of a version for the initial migration to actually be part of Flyway itself.M. Deinum
I tried it with 4.2.0 now - the same problem: no migration of the schema table.Jochen Marsaille
You also might want to upgrade to the latest 1.5.x version of Spring Boot, next to that make sure you aren't actually initializing or using Flyway yourself as that would bypass Spring Boot auto config and execution of flyway.M. Deinum
@M.Deinum please add your solution as answer: comments are meant for asking questions, clarifying points, warning about potential pitfalls, etcMarco Lackovic

1 Answers

0
votes

Problem solved as proposed by @M.Deinum:

Upgrade to the latest 1.5.x version of Spring Boot, next to that make sure you aren't actually initializing or using Flyway yourself as that would bypass Spring Boot auto config and execution of flyway.