-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Fix check vendor location in FlywayAutoConfiguration #10387
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
Fix check vendor location in FlywayAutoConfiguration #10387
Conversation
238a1ed to
5ef5685
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @eddumelendez
I don't understand why the code was moved to a separate auto-configuration. Can you expand on that please? I am not sure checking vendor location's location is a good thing. You may run your upgrades on a database that do not need a vendor specific script, in which case using the regular one only would make perfect sense?
Perhaps @vpavic has an opinion about that?
At the beginning I thought that previous validation (
Of course this is not required, we can use the default configuration o a custom one without need for vendor location. But, since this feature about resolve |
Yes but the problem is that you're not providing a path in your configuration, you are providing a placeholder that's going to be replaced with the database that you are using. If you are using two databases and one of them does not need specific scripts, the startup will fail because the directory does not exist. It means that the use case of this feature is quite narrowed IMO: all the databases that you support must require database specific scripts. Does that make sense? |
|
Thanks for the ping @snicoll.
Unless I'm missing something from the scenario you're describing, there shouldn't be a problem like this since the location validation is still based on finding at least one match in provided locations. The only difference is that the location under validation are now having |
|
If one uses only vendor specific locations things are currently broken by default in I've just faced this problem while upgrading from Setting |
|
@eddumelendez It looks like me like the code may be simpler if the validation was performed during the creation of the |
|
@wilkinsona I will rework this later today 😉 |
5ef5685 to
2ad12fd
Compare
| private Flyway createFlyway() { | ||
| Flyway flyway = new Flyway() { | ||
| @Override | ||
| public void setLocations(String... locations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wilkinsona I'm doing so because @ ConfigurationProperties is overriding the value. May the SpringBootFlyway class approach looks better? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes. Of course. I'd forgotten that we still bind directly to the Flyway instance. You're right. Let's keep the SpringBootFlyway class please.
`flyway.locations` supports vendor resolution. But, if `flyway.check-location=true` is added and there is just one location with vendor location the current implementation fails. This commit adds validation for vendor locations.
2ad12fd to
be93635
Compare
Update location check logic triggered if `flyway.check-location=true` to resolve any vendor placeholders in `flyway.locations`. See gh-10387
…ions * pr/10387: Polish location check with vendor placeholder Support location check with vendor placeholder
|
Thanks for updates. I've extracted the resolve logic into its own class and pushed this to master. |
flyway.locationssupports vendor resolution. But, ifflyway.check-location=trueis added and there is just one locationwith vendor location the current implementation fails. This commit adds
validation for vendor locations.