use of org.flywaydb.core.api.Location in project spring-boot by spring-projects.
the class Flyway7xAutoConfigurationTests method defaultFlyway.
@Test
void defaultFlyway() {
this.contextRunner.withUserConfiguration(DataSourceAutoConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
assertThat(flyway.getConfiguration().getLocations()).containsExactly(new Location("classpath:db/migration"));
});
}
use of org.flywaydb.core.api.Location in project dhis2-core by dhis2.
the class FlywayConfig method flyway.
@Bean(value = "flyway", initMethod = "migrate")
@Profile("!test-h2")
@DependsOn("dataSource")
public Flyway flyway(DhisConfigurationProvider configurationProvider, DataSource dataSource) {
ClassicConfiguration classicConfiguration = new ClassicConfiguration();
classicConfiguration.setDataSource(dataSource);
classicConfiguration.setBaselineOnMigrate(true);
classicConfiguration.setOutOfOrder(configurationProvider.isEnabled(FLYWAY_OUT_OF_ORDER_MIGRATION));
classicConfiguration.setIgnoreMissingMigrations(true);
classicConfiguration.setIgnoreFutureMigrations(false);
classicConfiguration.setGroup(true);
classicConfiguration.setLocations(new Location(FLYWAY_MIGRATION_FOLDER));
classicConfiguration.setMixed(true);
return new DhisFlyway(classicConfiguration, configurationProvider.isEnabled(FLYWAY_REPAIR_BEFORE_MIGRATION));
}
use of org.flywaydb.core.api.Location in project spring-boot by spring-projects.
the class FlywayAutoConfigurationTests method useVendorDirectory.
@Test
void useVendorDirectory() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class).withPropertyValues("spring.flyway.locations=classpath:db/vendors/{vendor},classpath:db/changelog").run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
assertThat(flyway.getConfiguration().getLocations()).containsExactlyInAnyOrder(new Location("classpath:db/vendors/h2"), new Location("classpath:db/changelog"));
});
}
use of org.flywaydb.core.api.Location in project spring-boot by spring-projects.
the class FlywayAutoConfigurationTests method useOneLocationWithVendorDirectory.
@Test
void useOneLocationWithVendorDirectory() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class).withPropertyValues("spring.flyway.locations=classpath:db/vendors/{vendor}").run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
assertThat(flyway.getConfiguration().getLocations()).containsExactly(new Location("classpath:db/vendors/h2"));
});
}
use of org.flywaydb.core.api.Location in project spring-boot by spring-projects.
the class Flyway5xAutoConfigurationTests method defaultFlyway.
@Test
void defaultFlyway() {
this.contextRunner.withUserConfiguration(DataSourceAutoConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);
Flyway flyway = context.getBean(Flyway.class);
assertThat(flyway.getConfiguration().getLocations()).containsExactly(new Location("classpath:db/migration"));
});
}
Aggregations