-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate support for checking Flyway locations #25488
Comments
I agree that it would be good to support location checking even with wildcard locations. I wonder if that is an enhancement to the flyway support and something that should go in 2.5.x or if we should treat it as a bug that needs to be fixed in 2.3.x. Flagging for team attention to see if there are any downsides to adding this support and if not, whether this should be a bug or enhancement (combined with documentation in 2.3.x and 2.4.x). |
I think we may now be creating more problems than we're solving by checking Flyway's locations. In addition to the wildcard support added in 6.4, 7.0 adds support for S3 and GCS (Google Cloud Storage). To check those accurately we'd need to use the respective SDKs which feels too much to me. With hindsight, if failing is a desirable feature when using Flyway, I think it should be implemented in Flyway rather than Spring Boot. With Flyway 7.5.3, the following is logged when check-locations is set to false and no migration scripts are found:
It's a similar story with 6.4 but with warning rather than error messages for the unresolvable locations:
Flyway switched from warnings to errors in 7.0. Our location checking has been available since Flyway support was added. The default changed from false to true in 2.0. |
We seem to be in agreement that checking Flyway's locations ourselves is no longer a good idea. Let's use this issue to deprecate the current support and document the known limitations. |
Spring Boot version 2.4.3 (could be any which supports Flyway 6.4)
With version 6.4 flyway introduced support for wildcards in scripts locations, see https://flywaydb.org/blog/organising-your-migrations. Unfortunately the Spring location checker is not consistent with the new flyway feature.
When defining locations with wildcards, eg.
spring.flyway.locations=classpath:/db/release-?.?/migration/
,spring.flyway.locations=classpath:/db/release-*/migration/
, Spring checks whether this location exists. In this case it certainly doesn't.As a workaround I can set
spring.flyway.check-location=false
but it took me some time to discover that the issue is indeed in Spring's additional path validation. Furthermore I'd like to check the location even when using wildcards.Sample project: https://github.com/MateuszSobala/spring_flyway-location-wildcards
Code which needs to be adjusted:
spring-boot/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
Line 164 in 3b235e4
The text was updated successfully, but these errors were encountered: