Move Flyway config properties to spring.flyway
Closes gh-9896
This commit is contained in:
parent
7cc4410613
commit
f9e316306a
|
@ -50,7 +50,7 @@ public class SpringApplicationHierarchyTests {
|
|||
@Test
|
||||
public void testParent() {
|
||||
SpringApplicationBuilder builder = new SpringApplicationBuilder(Child.class);
|
||||
builder.properties("flyway.enabled=false", "liquibase.enabled=false");
|
||||
builder.properties("spring.flyway.enabled=false", "liquibase.enabled=false");
|
||||
builder.parent(Parent.class);
|
||||
this.context = builder.run("--server.port=0");
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class SpringApplicationHierarchyTests {
|
|||
@Test
|
||||
public void testChild() {
|
||||
SpringApplicationBuilder builder = new SpringApplicationBuilder(Parent.class);
|
||||
builder.properties("flyway.enabled=false", "liquibase.enabled=false");
|
||||
builder.properties("spring.flyway.enabled=false", "liquibase.enabled=false");
|
||||
builder.child(Child.class);
|
||||
this.context = builder.run("--server.port=0");
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ import org.springframework.util.ObjectUtils;
|
|||
@Configuration
|
||||
@ConditionalOnClass(Flyway.class)
|
||||
@ConditionalOnBean(DataSource.class)
|
||||
@ConditionalOnProperty(prefix = "flyway", name = "enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(prefix = "spring.flyway", name = "enabled", matchIfMissing = true)
|
||||
@AutoConfigureAfter({ DataSourceAutoConfiguration.class,
|
||||
HibernateJpaAutoConfiguration.class })
|
||||
public class FlywayAutoConfiguration {
|
||||
|
@ -133,7 +133,7 @@ public class FlywayAutoConfiguration {
|
|||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "flyway")
|
||||
@ConfigurationProperties(prefix = "spring.flyway")
|
||||
public Flyway flyway() {
|
||||
Flyway flyway = new SpringBootFlyway();
|
||||
if (this.properties.isCreateDataSource()) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
* @author Dave Syer
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "flyway", ignoreUnknownFields = true)
|
||||
@ConfigurationProperties(prefix = "spring.flyway", ignoreUnknownFields = true)
|
||||
public class FlywayProperties {
|
||||
|
||||
/**
|
||||
|
|
|
@ -95,7 +95,7 @@ public class FlywayAutoConfigurationTests {
|
|||
|
||||
@Test
|
||||
public void createDataSource() throws Exception {
|
||||
TestPropertyValues.of("flyway.url:jdbc:hsqldb:mem:flywaytest", "flyway.user:sa")
|
||||
TestPropertyValues.of("spring.flyway.url:jdbc:hsqldb:mem:flywaytest", "spring.flyway.user:sa")
|
||||
.applyTo(this.context);
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
@ -126,7 +126,7 @@ public class FlywayAutoConfigurationTests {
|
|||
@Test
|
||||
public void overrideLocations() throws Exception {
|
||||
TestPropertyValues
|
||||
.of("flyway.locations:classpath:db/changelog,classpath:db/migration")
|
||||
.of("spring.flyway.locations:classpath:db/changelog,classpath:db/migration")
|
||||
.applyTo(this.context);
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
@ -139,8 +139,8 @@ public class FlywayAutoConfigurationTests {
|
|||
@Test
|
||||
public void overrideLocationsList() throws Exception {
|
||||
TestPropertyValues
|
||||
.of("flyway.locations[0]:classpath:db/changelog",
|
||||
"flyway.locations[1]:classpath:db/migration")
|
||||
.of("spring.flyway.locations[0]:classpath:db/changelog",
|
||||
"spring.flyway.locations[1]:classpath:db/migration")
|
||||
.applyTo(this.context);
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
@ -152,7 +152,7 @@ public class FlywayAutoConfigurationTests {
|
|||
|
||||
@Test
|
||||
public void overrideSchemas() throws Exception {
|
||||
TestPropertyValues.of("flyway.schemas:public").applyTo(this.context);
|
||||
TestPropertyValues.of("spring.flyway.schemas:public").applyTo(this.context);
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
|
@ -162,7 +162,7 @@ public class FlywayAutoConfigurationTests {
|
|||
|
||||
@Test
|
||||
public void changeLogDoesNotExist() throws Exception {
|
||||
TestPropertyValues.of("flyway.locations:file:no-such-dir").applyTo(this.context);
|
||||
TestPropertyValues.of("spring.flyway.locations:file:no-such-dir").applyTo(this.context);
|
||||
this.thrown.expect(BeanCreationException.class);
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
@ -172,8 +172,8 @@ public class FlywayAutoConfigurationTests {
|
|||
@Test
|
||||
public void checkLocationsAllMissing() throws Exception {
|
||||
TestPropertyValues
|
||||
.of("flyway.locations:classpath:db/missing1,classpath:db/migration2",
|
||||
"flyway.check-location:true")
|
||||
.of("spring.flyway.locations:classpath:db/missing1,classpath:db/migration2",
|
||||
"spring.flyway.check-location:true")
|
||||
.applyTo(this.context);
|
||||
this.thrown.expect(BeanCreationException.class);
|
||||
this.thrown.expectMessage("Cannot find migrations location in");
|
||||
|
@ -185,8 +185,8 @@ public class FlywayAutoConfigurationTests {
|
|||
@Test
|
||||
public void checkLocationsAllExist() throws Exception {
|
||||
TestPropertyValues
|
||||
.of("flyway.locations:classpath:db/changelog,classpath:db/migration",
|
||||
"flyway.check-location:true")
|
||||
.of("spring.flyway.locations:classpath:db/changelog,classpath:db/migration",
|
||||
"spring.flyway.check-location:true")
|
||||
.applyTo(this.context);
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
@ -222,7 +222,7 @@ public class FlywayAutoConfigurationTests {
|
|||
|
||||
@Test
|
||||
public void overrideBaselineVersionString() throws Exception {
|
||||
TestPropertyValues.of("flyway.baseline-version=0").applyTo(this.context);
|
||||
TestPropertyValues.of("spring.flyway.baseline-version=0").applyTo(this.context);
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
|
@ -234,7 +234,7 @@ public class FlywayAutoConfigurationTests {
|
|||
@Test
|
||||
public void overrideBaselineVersionNumber() throws Exception {
|
||||
Map<String, Object> source = Collections
|
||||
.<String, Object>singletonMap("flyway.baseline-version", 1);
|
||||
.<String, Object>singletonMap("spring.flyway.baseline-version", 1);
|
||||
this.context.getEnvironment().getPropertySources()
|
||||
.addLast(new MapPropertySource("flyway", source));
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
|
@ -248,7 +248,7 @@ public class FlywayAutoConfigurationTests {
|
|||
@Test
|
||||
public void useVendorDirectory() throws Exception {
|
||||
TestPropertyValues
|
||||
.of("flyway.locations=classpath:db/vendors/{vendor},classpath:db/changelog")
|
||||
.of("spring.flyway.locations=classpath:db/vendors/{vendor},classpath:db/changelog")
|
||||
.applyTo(this.context);
|
||||
registerAndRefresh(EmbeddedDataSourceConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
|
|
|
@ -105,7 +105,7 @@ public class HibernateJpaAutoConfigurationTests
|
|||
public void testFlywayPlusValidation() throws Exception {
|
||||
load(new Class<?>[0], new Class<?>[] { FlywayAutoConfiguration.class },
|
||||
"spring.datasource.initialize:false",
|
||||
"flyway.locations:classpath:db/city",
|
||||
"spring.flyway.locations:classpath:db/city",
|
||||
"spring.jpa.hibernate.ddl-auto:validate");
|
||||
}
|
||||
|
||||
|
|
|
@ -516,39 +516,39 @@ content into your application; rather pick only the properties that you need.
|
|||
# ----------------------------------------
|
||||
|
||||
# FLYWAY ({sc-spring-boot-autoconfigure}/flyway/FlywayProperties.{sc-ext}[FlywayProperties])
|
||||
flyway.allow-mixed-migrations= #
|
||||
flyway.baseline-description= #
|
||||
flyway.baseline-on-migrate= #
|
||||
flyway.baseline-version=1 # version to start migration
|
||||
flyway.check-location=false # Check that migration scripts location exists.
|
||||
flyway.clean-disabled= #
|
||||
flyway.clean-on-validation-error= #
|
||||
flyway.enabled=true # Enable flyway.
|
||||
flyway.encoding= #
|
||||
flyway.ignore-failed-future-migration= #
|
||||
flyway.ignore-future-migrations= #
|
||||
flyway.ignore-missing-migrations= #
|
||||
flyway.init-sqls= # SQL statements to execute to initialize a connection immediately after obtaining it.
|
||||
flyway.installed-by= #
|
||||
flyway.locations=classpath:db/migration # locations of migrations scripts
|
||||
flyway.out-of-order= #
|
||||
flyway.password= # JDBC password if you want Flyway to create its own DataSource
|
||||
flyway.placeholder-prefix= #
|
||||
flyway.placeholder-replacement= #
|
||||
flyway.placeholder-suffix= #
|
||||
flyway.placeholders.*= #
|
||||
flyway.repeatable-sql-migration-prefix= #
|
||||
flyway.schemas= # schemas to update
|
||||
flyway.skip-default-callbacks= #
|
||||
flyway.skip-default-resolvers= #
|
||||
flyway.sql-migration-prefix=V #
|
||||
flyway.sql-migration-separator= #
|
||||
flyway.sql-migration-suffix=.sql #
|
||||
flyway.table= #
|
||||
flyway.target= #
|
||||
flyway.url= # JDBC url of the database to migrate. If not set, the primary configured data source is used.
|
||||
flyway.user= # Login user of the database to migrate.
|
||||
flyway.validate-on-migrate= #
|
||||
spring.flyway.allow-mixed-migrations= #
|
||||
spring.flyway.baseline-description= #
|
||||
spring.flyway.baseline-on-migrate= #
|
||||
spring.flyway.baseline-version=1 # version to start migration
|
||||
spring.flyway.check-location=false # Check that migration scripts location exists.
|
||||
spring.flyway.clean-disabled= #
|
||||
spring.flyway.clean-on-validation-error= #
|
||||
spring.flyway.enabled=true # Enable flyway.
|
||||
spring.flyway.encoding= #
|
||||
spring.flyway.ignore-failed-future-migration= #
|
||||
spring.flyway.ignore-future-migrations= #
|
||||
spring.flyway.ignore-missing-migrations= #
|
||||
spring.flyway.init-sqls= # SQL statements to execute to initialize a connection immediately after obtaining it.
|
||||
spring.flyway.installed-by= #
|
||||
spring.flyway.locations=classpath:db/migration # locations of migrations scripts
|
||||
spring.flyway.out-of-order= #
|
||||
spring.flyway.password= # JDBC password if you want Flyway to create its own DataSource
|
||||
spring.flyway.placeholder-prefix= #
|
||||
spring.flyway.placeholder-replacement= #
|
||||
spring.flyway.placeholder-suffix= #
|
||||
spring.flyway.placeholders.*= #
|
||||
spring.flyway.repeatable-sql-migration-prefix= #
|
||||
spring.flyway.schemas= # schemas to update
|
||||
spring.flyway.skip-default-callbacks= #
|
||||
spring.flyway.skip-default-resolvers= #
|
||||
spring.flyway.sql-migration-prefix=V #
|
||||
spring.flyway.sql-migration-separator= #
|
||||
spring.flyway.sql-migration-suffix=.sql #
|
||||
spring.flyway.table= #
|
||||
spring.flyway.target= #
|
||||
spring.flyway.url= # JDBC url of the database to migrate. If not set, the primary configured data source is used.
|
||||
spring.flyway.user= # Login user of the database to migrate.
|
||||
spring.flyway.validate-on-migrate= #
|
||||
|
||||
# LIQUIBASE ({sc-spring-boot-autoconfigure}/liquibase/LiquibaseProperties.{sc-ext}[LiquibaseProperties])
|
||||
liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path.
|
||||
|
|
Loading…
Reference in New Issue