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
Provide a configuration property for configuring Flyway's use of transactional locks with PostgreSQL #32629
Comments
As described in the Spring Boot documentation, you can use a If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. |
@wilkinsona , this issue (flyway/flyway#3492) seems to be quite a big one. I think it would be a good idea to have this property, as I'm assuming that as of Spring Boot 3.x, it will be an issue for many users. |
In our Spring Boot based framework, we provided a FlywayConfigurationCustomizer bean that set flyway.postgresql.transactional.lock to false. We see however that when our users use e.g. Note that the migration script that was hanging was due to a |
You can put in
|
Thanks @radek-los-s1 , however: There are 3 ways I'm aware of how to run flyway migrations:
Out of all the methods of configuring flyway migrations (https://flywaydb.org/documentation/configuration/parameters/postgresqlTransactionalLock), the only way to change a Spring Boot triggered flyway migration configuration, is via the provided Spring Boot Flyway properties / programmatically via the api. We'd strongly prefer Spring Boot provides a property to configure this setting, as it has become a common source of issues for users. |
flyway.postgresql.transactional.lock
There is a |
The map takes properties in the standard Flyway format which is dot-separated with camel case parts. If we had a The map would allow any Flyway property to be configured, the vast majority of which would clash with our existing properties, for example:
Here connect retries would be either My feeling is that if we're going to do something here, it should be for specific properties rather than opening up the |
For information, this works fine: @Bean
public FlywayConfigurationCustomizer flywayCustomizer() {
return configuration -> configuration.configuration(Map.of("flyway.postgresql.transactional.lock", "false"));
} As |
How do you use this property in application.properties?
|
The application property is |
I am using Spring Boot 3.2.4 and Flyway 9.22.3 and have tested both I have even tried
from #32629 (comment) However, my issue was that I was using a custom Flyway Bean, and because of that, the properties were not being loaded automatically. For me, what worked was to build up from the previous answers, so I added Below is a reduced form of it. @Bean
public Flyway flyway(FlywayProperties flywayProperties)
{
Flyway flyway = Flyway.configure()
// previous configurations
// below the added line
.configuration(Map.of("flyway.postgresql.transactional.lock", "false"))
.load();
flyway.migrate();
return flyway;
} Not sure if this is the best approach, but it worked for me. If you guys have improvement suggestions, they are welcome. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Solution provided by @jluiz20 was the only one that worked for me, after trying Gradle and Spring properties related suggestions, i.e. I had to create a custom Flyway bean. Gist Using Spring Boot 3.2.4 and Flyway 10.11.0. I'm guessing it depends whether flyway is run from the Gradle plugin or spring boot app during startup which solution will have the desired effect. |
Hi,
In the project which I'm working on, we need to run non-transactional migration, but it seems that spring flyway autoconfigure doesn't allow configuring the option
flyway.postgresql.transactional.lock
- flyway docs.Is there any other option how for configuring transaction lock with spring config?
The text was updated successfully, but these errors were encountered: