|
|
|
@ -141,6 +141,12 @@ public class FlywayAutoConfiguration {
|
|
|
|
|
return new PropertiesFlywayConnectionDetails(this.properties);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
@ConditionalOnClass(name = "org.flywaydb.database.sqlserver.SQLServerConfigurationExtension")
|
|
|
|
|
SqlServerFlywayConfigurationCustomizer sqlServerFlywayConfigurationCustomizer() {
|
|
|
|
|
return new SqlServerFlywayConfigurationCustomizer(this.properties);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
@ConditionalOnClass(name = "org.flywaydb.database.oracle.OracleConfigurationExtension")
|
|
|
|
|
OracleFlywayConfigurationCustomizer oracleFlywayConfigurationCustomizer() {
|
|
|
|
@ -267,10 +273,6 @@ public class FlywayAutoConfiguration {
|
|
|
|
|
map.from(properties.getJdbcProperties()).whenNot(Map::isEmpty).to(configuration::jdbcProperties);
|
|
|
|
|
map.from(properties.getKerberosConfigFile()).to(configuration::kerberosConfigFile);
|
|
|
|
|
map.from(properties.getOutputQueryResults()).to(configuration::outputQueryResults);
|
|
|
|
|
map.from(properties.getSqlServerKerberosLoginFile())
|
|
|
|
|
.whenNonNull()
|
|
|
|
|
.to((sqlServerKerberosLoginFile) -> configureSqlServerKerberosLoginFile(configuration,
|
|
|
|
|
sqlServerKerberosLoginFile));
|
|
|
|
|
map.from(properties.getSkipExecutingMigrations()).to(configuration::skipExecutingMigrations);
|
|
|
|
|
map.from(properties.getIgnoreMigrationPatterns())
|
|
|
|
|
.whenNot(List::isEmpty)
|
|
|
|
@ -289,14 +291,6 @@ public class FlywayAutoConfiguration {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void configureSqlServerKerberosLoginFile(FluentConfiguration configuration,
|
|
|
|
|
String sqlServerKerberosLoginFile) {
|
|
|
|
|
SQLServerConfigurationExtension sqlServerConfigurationExtension = configuration.getPluginRegister()
|
|
|
|
|
.getPlugin(SQLServerConfigurationExtension.class);
|
|
|
|
|
Assert.state(sqlServerConfigurationExtension != null, "Flyway SQL Server extension missing");
|
|
|
|
|
sqlServerConfigurationExtension.getKerberos().getLogin().setFile(sqlServerKerberosLoginFile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void configureCallbacks(FluentConfiguration configuration, List<Callback> callbacks) {
|
|
|
|
|
if (!callbacks.isEmpty()) {
|
|
|
|
|
configuration.callbacks(callbacks.toArray(new Callback[0]));
|
|
|
|
@ -484,6 +478,31 @@ public class FlywayAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Order(Ordered.HIGHEST_PRECEDENCE)
|
|
|
|
|
static final class SqlServerFlywayConfigurationCustomizer implements FlywayConfigurationCustomizer {
|
|
|
|
|
|
|
|
|
|
private final FlywayProperties properties;
|
|
|
|
|
|
|
|
|
|
SqlServerFlywayConfigurationCustomizer(FlywayProperties properties) {
|
|
|
|
|
this.properties = properties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void customize(FluentConfiguration configuration) {
|
|
|
|
|
ConfigurationExtensionMapper<SQLServerConfigurationExtension> map = new ConfigurationExtensionMapper<>(
|
|
|
|
|
PropertyMapper.get().alwaysApplyingWhenNonNull(), () -> {
|
|
|
|
|
SQLServerConfigurationExtension extension = configuration.getPluginRegister()
|
|
|
|
|
.getPlugin(SQLServerConfigurationExtension.class);
|
|
|
|
|
Assert.notNull(extension, "Flyway SQL Server extension missing");
|
|
|
|
|
return extension;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
map.apply(this.properties.getSqlServerKerberosLoginFile(),
|
|
|
|
|
(extension, file) -> extension.getKerberos().getLogin().setFile(file));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static class ConfigurationExtensionMapper<T extends ConfigurationExtension> {
|
|
|
|
|
|
|
|
|
|
private final PropertyMapper map;
|
|
|
|
|