Polish "Upgrade to Flyway 6.0.1"

See gh-17997
pull/18015/head
Andy Wilkinson 5 years ago
parent 278b20d9c9
commit 0e2a131e5d

@ -83,7 +83,6 @@ import org.springframework.util.StringUtils;
* @author Semyon Danilov
* @since 1.1.0
*/
@SuppressWarnings("deprecation")
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(Flyway.class)
@Conditional(FlywayDataSourceCondition.class)
@ -166,6 +165,7 @@ public class FlywayAutoConfiguration {
map.from(properties.getConnectRetries()).to(configuration::connectRetries);
map.from(properties.getSchemas()).as(StringUtils::toStringArray).to(configuration::schemas);
map.from(properties.getTable()).to(configuration::table);
map.from(properties.getTablespace()).to(configuration::tablespace);
map.from(properties.getBaselineDescription()).to(configuration::baselineDescription);
map.from(properties.getBaselineVersion()).to(configuration::baselineVersion);
map.from(properties.getInstalledBy()).to(configuration::installedBy);
@ -198,6 +198,7 @@ public class FlywayAutoConfiguration {
map.from(properties.getErrorOverrides()).whenNonNull().to(configuration::errorOverrides);
map.from(properties.getLicenseKey()).whenNonNull().to(configuration::licenseKey);
map.from(properties.getOracleSqlplus()).whenNonNull().to(configuration::oracleSqlplus);
map.from(properties.getOracleSqlplusWarn()).whenNonNull().to(configuration::oracleSqlplusWarn);
map.from(properties.getStream()).whenNonNull().to(configuration::stream);
map.from(properties.getUndoSqlMigrationPrefix()).whenNonNull().to(configuration::undoSqlMigrationPrefix);
}

@ -74,6 +74,13 @@ public class FlywayProperties {
*/
private String table = "flyway_schema_history";
/**
* Tablespace in which the schema history table is created. Ignored when using a
* database that does not support tablespaces. Defaults to the default tablespace of
* the connection used by Flyway.
*/
private String tablespace;
/**
* Description to tag an existing schema with when applying a baseline.
*/
@ -252,6 +259,12 @@ public class FlywayProperties {
*/
private Boolean oracleSqlplus;
/**
* Whether to issue a warning rather than an error when a not-yet-supported Oracle
* SQL*Plus statement is encountered. Requires Flyway Pro or Flyway Enterprise.
*/
private Boolean oracleSqlplusWarn;
/**
* Whether to stream SQL migrations when executing them. Requires Flyway Pro or Flyway
* Enterprise.
@ -319,6 +332,14 @@ public class FlywayProperties {
this.table = table;
}
public String getTablespace() {
return this.tablespace;
}
public void setTablespace(String tablespace) {
this.tablespace = tablespace;
}
public String getBaselineDescription() {
return this.baselineDescription;
}
@ -595,6 +616,14 @@ public class FlywayProperties {
this.oracleSqlplus = oracleSqlplus;
}
public Boolean getOracleSqlplusWarn() {
return this.oracleSqlplusWarn;
}
public void setOracleSqlplusWarn(Boolean oracleSqlplusWarn) {
this.oracleSqlplusWarn = oracleSqlplusWarn;
}
public Boolean getStream() {
return this.stream;
}

@ -70,7 +70,6 @@ import static org.mockito.Mockito.mock;
* @author Dominic Gunn
* @author András Deák
*/
@SuppressWarnings("deprecation")
class FlywayAutoConfigurationTests {
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
@ -411,6 +410,17 @@ class FlywayAutoConfigurationTests {
});
}
@Test
void oracleSqlplusWarnIsCorrectlyMapped() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.flyway.oracle-sqlplus-warn=true").run((context) -> {
assertThat(context).hasFailed();
Throwable failure = context.getStartupFailure();
assertThat(failure).hasRootCauseInstanceOf(FlywayProUpgradeRequiredException.class);
assertThat(failure).hasMessageContaining(" oracle.sqlplusWarn ");
});
}
@Test
void streamIsCorrectlyMapped() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)

@ -96,10 +96,9 @@ class FlywayPropertiesTests {
ignoreProperties(properties, "url", "user", "password", "enabled", "checkLocation", "createDataSource");
// High level object we can't set with properties
ignoreProperties(configuration, "classLoader", "dataSource", "resolvers", "callbacks", "javaMigrations");
ignoreProperties(configuration, "callbacks", "classLoader", "dataSource", "javaMigrations", "resolvers");
// Properties we don't want to expose
ignoreProperties(configuration, "resolversAsClassNames", "callbacksAsClassNames", "tablespace",
"oracleSqlplusWarn");
ignoreProperties(configuration, "resolversAsClassNames", "callbacksAsClassNames");
// Handled by the conversion service
ignoreProperties(configuration, "baselineVersionAsString", "encodingAsString", "locationsAsStrings",
"targetAsString");

Loading…
Cancel
Save