|
|
@ -75,6 +75,9 @@ public class FlywayAutoConfiguration {
|
|
|
|
@FlywayDataSource
|
|
|
|
@FlywayDataSource
|
|
|
|
private DataSource flywayDataSource;
|
|
|
|
private DataSource flywayDataSource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired(required = false)
|
|
|
|
|
|
|
|
private FlywayMigrationStrategy migrationStrategy;
|
|
|
|
|
|
|
|
|
|
|
|
@PostConstruct
|
|
|
|
@PostConstruct
|
|
|
|
public void checkLocationExists() {
|
|
|
|
public void checkLocationExists() {
|
|
|
|
if (this.properties.isCheckLocation()) {
|
|
|
|
if (this.properties.isCheckLocation()) {
|
|
|
@ -96,12 +99,6 @@ public class FlywayAutoConfiguration {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
|
|
|
|
public FlywayMigrationStrategy flywayMigrationStrategy() {
|
|
|
|
|
|
|
|
return new FlywayMigrationStrategy();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConfigurationProperties(prefix = "flyway")
|
|
|
|
@ConfigurationProperties(prefix = "flyway")
|
|
|
|
public Flyway flyway() {
|
|
|
|
public Flyway flyway() {
|
|
|
@ -121,9 +118,8 @@ public class FlywayAutoConfiguration {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public FlywayMigrationInitializer flywayInitializer(Flyway flyway,
|
|
|
|
public FlywayMigrationInitializer flywayInitializer(Flyway flyway) {
|
|
|
|
FlywayMigrationStrategy migrationStrategy) {
|
|
|
|
return new FlywayMigrationInitializer(flyway, this.migrationStrategy);
|
|
|
|
return new FlywayMigrationInitializer(flyway, migrationStrategy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -163,7 +159,12 @@ public class FlywayAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void afterPropertiesSet() throws Exception {
|
|
|
|
public void afterPropertiesSet() throws Exception {
|
|
|
|
this.migrationStrategy.migrate(this.flyway);
|
|
|
|
if (this.migrationStrategy != null) {
|
|
|
|
|
|
|
|
this.migrationStrategy.migrate(this.flyway);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
this.flyway.migrate();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|