-
Notifications
You must be signed in to change notification settings - Fork 41.1k
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
Add property to avoid flyway-migrate on startup #44905
Comments
Thanks for the suggestion. Can you please expand upon "externally controlled migration at runtime is also a relevant scenario", particularly in terms of how it works with other components that make use of the |
This scenario is relevant to decouple deployment and migrate in zero downtime migrations (see here). The implicit feature flag is the data model change, which will be applied at runtime. The persistence layer has to be compatible to the last and the future database model, which are boundled. At startup time the migrations will not be applied and the persistence layer depends on the last migrated database model. After invoking |
Thanks, @bekoenig. I wonder how useful an on/off property will be given that Flyway has several different actions that it can perform:
By default, Boot calls For your needs, the property could be set to indicate that no actions should be performed:
It could also accept multiple actions and perform them in order:
I'll discuss this with the team. In the meantime, please continue to use a custom migration strategy. |
Hi. @wilkinsona This looks like that it can be a "good first issue". If you agree with me, after deciding with the team, if it is going to developed, could you please consider me as the contributer? I would really be happy to help. Thanks in advance. |
We discussed this today and decided that we don't think it's worth adding a property to control this behavior as the saving vs a custom migration strategy bean is minimal: @Bean
FlywayMigrationStrategy customMigrationStrategy() {
return (flyway) -> {};
} Thanks anyway for the suggestion. |
In addition to automatic migration at application startup, externally controlled migration at runtime is also a relevant scenario. Currently, to prevent migration at application startup, one would have to provide an empty implementation of
FlywayMigrationInitializer
.It would be desirable to extend
FlywayMigrationInitializer flywayInitializer(...)
by@ConditionalOnBooleanProperty(name = "spring.flyway.auto-startup", matchIfMissing = true)
.The text was updated successfully, but these errors were encountered: