Polish "Upgrade to Flyway 7.9.2"
See gh-26456
This commit is contained in:
@@ -258,7 +258,7 @@ public class FlywayAutoConfiguration {
|
||||
.to((ignoreMigrationPatterns) -> configuration
|
||||
.ignoreMigrationPatterns(ignoreMigrationPatterns.toArray(new String[0])));
|
||||
// No method reference for compatibility with Flyway version < 7.9
|
||||
map.from(properties.getDetectEncoding()).whenNonNull()
|
||||
map.from(properties.getDetectEncoding())
|
||||
.to((detectEncoding) -> configuration.detectEncoding(detectEncoding));
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,7 @@ public class FlywayProperties {
|
||||
private boolean checkLocation = true;
|
||||
|
||||
/**
|
||||
* Whether Flyway should fail if a location specified in the flyway.locations option
|
||||
* doesn't exist.
|
||||
* Whether to fail if a location of migration scripts doesn't exist.
|
||||
*/
|
||||
private boolean failOnMissingLocations;
|
||||
|
||||
@@ -368,8 +367,8 @@ public class FlywayProperties {
|
||||
private List<String> ignoreMigrationPatterns;
|
||||
|
||||
/**
|
||||
* Whether Flyway should try to automatically detect SQL migration file encoding.
|
||||
* Requires Flyway Teams.
|
||||
* Whether to attempt to automatically detect SQL migration file encoding. Requires
|
||||
* Flyway Teams.
|
||||
*/
|
||||
private Boolean detectEncoding;
|
||||
|
||||
|
||||
@@ -288,6 +288,7 @@ class FlywayAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Deprecated
|
||||
void checkLocationsAllMissing() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.flyway.locations:classpath:db/missing1,classpath:db/migration2")
|
||||
@@ -299,6 +300,7 @@ class FlywayAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Deprecated
|
||||
void checkLocationsAllExist() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.flyway.locations:classpath:db/changelog,classpath:db/migration")
|
||||
@@ -306,6 +308,7 @@ class FlywayAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Deprecated
|
||||
void checkLocationsAllExistWithImplicitClasspathPrefix() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.flyway.locations:db/changelog,db/migration")
|
||||
@@ -313,12 +316,53 @@ class FlywayAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Deprecated
|
||||
void checkLocationsAllExistWithFilesystemPrefix() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.flyway.locations:filesystem:src/test/resources/db/migration")
|
||||
.run((context) -> assertThat(context).hasNotFailed());
|
||||
}
|
||||
|
||||
@Test
|
||||
void failOnMissingLocationsAllMissing() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.flyway.check-location=false",
|
||||
"spring.flyway.fail-on-missing-locations=true")
|
||||
.withPropertyValues("spring.flyway.locations:classpath:db/missing1,classpath:db/migration2")
|
||||
.run((context) -> {
|
||||
assertThat(context).hasFailed();
|
||||
assertThat(context).getFailure().isInstanceOf(BeanCreationException.class);
|
||||
assertThat(context).getFailure().hasMessageContaining("Unable to resolve location");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void failOnMissingLocationsAllExist() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.flyway.check-location=false",
|
||||
"spring.flyway.fail-on-missing-locations=true")
|
||||
.withPropertyValues("spring.flyway.locations:classpath:db/changelog,classpath:db/migration")
|
||||
.run((context) -> assertThat(context).hasNotFailed());
|
||||
}
|
||||
|
||||
@Test
|
||||
void failOnMissingLocationsAllExistWithImplicitClasspathPrefix() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.flyway.check-location=false",
|
||||
"spring.flyway.fail-on-missing-locations=true")
|
||||
.withPropertyValues("spring.flyway.locations:db/changelog,db/migration")
|
||||
.run((context) -> assertThat(context).hasNotFailed());
|
||||
}
|
||||
|
||||
@Test
|
||||
void failOnMissingLocationsAllExistWithFilesystemPrefix() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.flyway.check-location=false",
|
||||
"spring.flyway.fail-on-missing-locations=true")
|
||||
.withPropertyValues("spring.flyway.locations:filesystem:src/test/resources/db/migration")
|
||||
.run((context) -> assertThat(context).hasNotFailed());
|
||||
}
|
||||
|
||||
@Test
|
||||
void customFlywayMigrationStrategy() {
|
||||
this.contextRunner
|
||||
|
||||
Reference in New Issue
Block a user