Home > Software engineering >  Flyway wildcard is not working in Spring Boot
Flyway wildcard is not working in Spring Boot

Time:10-20

I get the following error:


Flyway failed to initialize: none of the following migration scripts locations could be found:

    - classpath:db/*/migrations/

This is what the directory structure looks like:

Folder structure

And this is what I've tried:

# examples, obviously I tried these independently from each other
spring:
    flyway:
# these work:
        locations: "classpath:db"
        locations: "classpath:db/release_1.0/migrations/"

# these don't work: (I am getting the same error as shown above)
        locations: "classpath:db/**/migrations/"
        locations: "classpath:db/release*/migrations/"
        locations: "classpath:db/*/migrations/"

But they should work according to this blogpost from version 6.4. (I don't see it documented that they have removed it)

I am using spring-boot-starter-parent 2.4.1, so it is Flyway 7.1.1.

Can anyone explain to me how to specify the migrations folder using a wildcard in Flyway and why is it not working?

CodePudding user response:

As Flyway's location support has grown to support wildcards, cloud storage, etc., Spring Boot's ability to accurately check the locations has decreased as described in this issue. As a result, support for location checking was deprecated in Spring Boot 2.5 and, after the deprecation period, it will be removed entirely. In the meantime, you can switch it off by setting spring.flyway.check-location to false.

  • Related