Commit 0ae075ef authored by Kedar Joshi's avatar Kedar Joshi Committed by Stephane Nicoll

Upgrade to Flyway 6.2.0

See gh-19894
parent c624708c
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -218,6 +218,8 @@ public class FlywayAutoConfiguration {
.to((oracleSqlplusWarn) -> configuration.oracleSqlplusWarn(oracleSqlplusWarn));
map.from(properties.getStream()).whenNonNull().to(configuration::stream);
map.from(properties.getUndoSqlMigrationPrefix()).whenNonNull().to(configuration::undoSqlMigrationPrefix);
// No method reference for compatibility with Flyway version < 6.2
configureValidateMigrationNaming(configuration, properties.isValidateMigrationNaming());
}
private void configureCallbacks(FluentConfiguration configuration, List<Callback> callbacks) {
......@@ -243,6 +245,15 @@ public class FlywayAutoConfiguration {
}
}
private void configureValidateMigrationNaming(FluentConfiguration flyway, boolean isValidateMigrationNaming) {
try {
flyway.validateMigrationNaming(isValidateMigrationNaming);
}
catch (NoSuchMethodError ex) {
// Flyway < v6.2
}
}
private String getProperty(Supplier<String> property, Supplier<String> defaultValue) {
String value = property.get();
return (value != null) ? value : defaultValue.get();
......
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -209,6 +209,12 @@ public class FlywayProperties {
*/
private boolean ignoreFutureMigrations = true;
/**
* Whether to validate migrations and callbacks whose scripts do not obey the correct
* naming convention.
*/
private boolean validateMigrationNaming = false;
/**
* Whether to allow mixing transactional and non-transactional statements within the
* same migration.
......@@ -549,6 +555,14 @@ public class FlywayProperties {
this.ignoreFutureMigrations = ignoreFutureMigrations;
}
public boolean isValidateMigrationNaming() {
return this.validateMigrationNaming;
}
public void setValidateMigrationNaming(boolean validateMigrationNaming) {
this.validateMigrationNaming = validateMigrationNaming;
}
public boolean isMixed() {
return this.mixed;
}
......
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -80,6 +80,7 @@ class FlywayPropertiesTests {
assertThat(configuration.isIgnoreIgnoredMigrations()).isEqualTo(properties.isIgnoreIgnoredMigrations());
assertThat(configuration.isIgnorePendingMigrations()).isEqualTo(properties.isIgnorePendingMigrations());
assertThat(configuration.isIgnoreFutureMigrations()).isEqualTo(properties.isIgnoreFutureMigrations());
assertThat(configuration.isValidateMigrationNaming()).isEqualTo(properties.isValidateMigrationNaming());
assertThat(configuration.isMixed()).isEqualTo(properties.isMixed());
assertThat(configuration.isOutOfOrder()).isEqualTo(properties.isOutOfOrder());
assertThat(configuration.isSkipDefaultCallbacks()).isEqualTo(properties.isSkipDefaultCallbacks());
......
......@@ -335,7 +335,7 @@ bom {
]
}
}
library("Flyway", "6.1.3") {
library("Flyway", "6.2.0") {
group("org.flywaydb") {
modules = [
"flyway-core"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment