Spring Boot's FlywayProperties.java supports many of the Flyway settings but not 'baselineVersion' or 'baselineOnMigrate'. I am converting an existing application to Flyway and these setting appear to be designed for this purpose. Our production environment is highly controlled and running a commandline version of flyway there to achieve this is not practical.
Is creating a custom Flyway @Bean the only option here?
Configuring Flyway Database gradle file. In application properties, we need to configure the database properties for creating a DataSource and also flyway properties we need to configure in application properties. For properties file users, add the below properties in the application. properties file.
Description. The version to tag an existing schema with when executing baseline.
You can set any of flyways properties be prefixing them with flyway
in your application.yml/.properties
.
It is made possible by org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration.FlywayConfiguration#flyway
which is annotated with @ConfigurationProperties(prefix = "flyway")
.
If you are using an application.yml
add the following:
flyway:
baselineOnMigrate: true
If using an application.properties
add the following:
flyway.baselineOnMigrate = true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With