|
|
|
@ -36,6 +36,7 @@ import org.flywaydb.core.api.callback.Callback;
|
|
|
|
|
import org.flywaydb.core.api.configuration.FluentConfiguration;
|
|
|
|
|
import org.flywaydb.core.api.migration.JavaMigration;
|
|
|
|
|
import org.flywaydb.core.extensibility.ConfigurationExtension;
|
|
|
|
|
import org.flywaydb.core.internal.database.postgresql.PostgreSQLConfigurationExtension;
|
|
|
|
|
import org.flywaydb.database.oracle.OracleConfigurationExtension;
|
|
|
|
|
import org.flywaydb.database.sqlserver.SQLServerConfigurationExtension;
|
|
|
|
|
|
|
|
|
@ -153,6 +154,12 @@ public class FlywayAutoConfiguration {
|
|
|
|
|
return new OracleFlywayConfigurationCustomizer(this.properties);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
@ConditionalOnClass(name = "org.flywaydb.core.internal.database.postgresql.PostgreSQLConfigurationExtension")
|
|
|
|
|
PostgresqlFlywayConfigurationCustomizer postgresqlFlywayConfigurationCustomizer() {
|
|
|
|
|
return new PostgresqlFlywayConfigurationCustomizer(this.properties);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
Flyway flyway(FlywayConnectionDetails connectionDetails, ResourceLoader resourceLoader,
|
|
|
|
|
ObjectProvider<DataSource> dataSource, @FlywayDataSource ObjectProvider<DataSource> flywayDataSource,
|
|
|
|
@ -478,6 +485,30 @@ public class FlywayAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Order(Ordered.HIGHEST_PRECEDENCE)
|
|
|
|
|
static final class PostgresqlFlywayConfigurationCustomizer implements FlywayConfigurationCustomizer {
|
|
|
|
|
|
|
|
|
|
private final FlywayProperties properties;
|
|
|
|
|
|
|
|
|
|
PostgresqlFlywayConfigurationCustomizer(FlywayProperties properties) {
|
|
|
|
|
this.properties = properties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void customize(FluentConfiguration configuration) {
|
|
|
|
|
ConfigurationExtensionMapper<PostgreSQLConfigurationExtension> map = new ConfigurationExtensionMapper<>(
|
|
|
|
|
PropertyMapper.get().alwaysApplyingWhenNonNull(), () -> {
|
|
|
|
|
PostgreSQLConfigurationExtension extension = configuration.getPluginRegister()
|
|
|
|
|
.getPlugin(PostgreSQLConfigurationExtension.class);
|
|
|
|
|
Assert.notNull(extension, "PostgreSQL extension missing");
|
|
|
|
|
return extension;
|
|
|
|
|
});
|
|
|
|
|
map.apply(this.properties.getPostgresql().getTransactionalLock(),
|
|
|
|
|
PostgreSQLConfigurationExtension::setTransactionalLock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Order(Ordered.HIGHEST_PRECEDENCE)
|
|
|
|
|
static final class SqlServerFlywayConfigurationCustomizer implements FlywayConfigurationCustomizer {
|
|
|
|
|
|
|
|
|
|