Merge pull request #19894 from kedar-joshi
* pr/19894: Polish "Upgrade to Flyway 6.2.0" Upgrade to Flyway 6.2.0 Closes gh-19894
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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.
|
||||
@@ -206,6 +206,7 @@ public class FlywayAutoConfiguration {
|
||||
map.from(properties.isOutOfOrder()).to(configuration::outOfOrder);
|
||||
map.from(properties.isSkipDefaultCallbacks()).to(configuration::skipDefaultCallbacks);
|
||||
map.from(properties.isSkipDefaultResolvers()).to(configuration::skipDefaultResolvers);
|
||||
configureValidateMigrationNaming(configuration, properties.isValidateMigrationNaming());
|
||||
map.from(properties.isValidateOnMigrate()).to(configuration::validateOnMigrate);
|
||||
// Pro properties
|
||||
map.from(properties.getBatch()).whenNonNull().to(configuration::batch);
|
||||
@@ -220,6 +221,16 @@ public class FlywayAutoConfiguration {
|
||||
map.from(properties.getUndoSqlMigrationPrefix()).whenNonNull().to(configuration::undoSqlMigrationPrefix);
|
||||
}
|
||||
|
||||
private void configureValidateMigrationNaming(FluentConfiguration configuration,
|
||||
boolean validateMigrationNaming) {
|
||||
try {
|
||||
configuration.validateMigrationNaming(validateMigrationNaming);
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
// Flyway < 6.2
|
||||
}
|
||||
}
|
||||
|
||||
private void configureCallbacks(FluentConfiguration configuration, List<Callback> callbacks) {
|
||||
if (!callbacks.isEmpty()) {
|
||||
configuration.callbacks(callbacks.toArray(new Callback[0]));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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.
|
||||
@@ -230,6 +230,12 @@ public class FlywayProperties {
|
||||
*/
|
||||
private boolean skipDefaultResolvers;
|
||||
|
||||
/**
|
||||
* Whether to validate migrations and callbacks whose scripts do not obey the correct
|
||||
* naming convention.
|
||||
*/
|
||||
private boolean validateMigrationNaming = false;
|
||||
|
||||
/**
|
||||
* Whether to automatically call validate when performing a migration.
|
||||
*/
|
||||
@@ -581,6 +587,14 @@ public class FlywayProperties {
|
||||
this.skipDefaultResolvers = skipDefaultResolvers;
|
||||
}
|
||||
|
||||
public boolean isValidateMigrationNaming() {
|
||||
return this.validateMigrationNaming;
|
||||
}
|
||||
|
||||
public void setValidateMigrationNaming(boolean validateMigrationNaming) {
|
||||
this.validateMigrationNaming = validateMigrationNaming;
|
||||
}
|
||||
|
||||
public boolean isValidateOnMigrate() {
|
||||
return this.validateOnMigrate;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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.
|
||||
@@ -84,6 +84,7 @@ class FlywayPropertiesTests {
|
||||
assertThat(configuration.isOutOfOrder()).isEqualTo(properties.isOutOfOrder());
|
||||
assertThat(configuration.isSkipDefaultCallbacks()).isEqualTo(properties.isSkipDefaultCallbacks());
|
||||
assertThat(configuration.isSkipDefaultResolvers()).isEqualTo(properties.isSkipDefaultResolvers());
|
||||
assertThat(configuration.isValidateMigrationNaming()).isEqualTo(properties.isValidateMigrationNaming());
|
||||
assertThat(configuration.isValidateOnMigrate()).isEqualTo(properties.isValidateOnMigrate());
|
||||
}
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ bom {
|
||||
]
|
||||
}
|
||||
}
|
||||
library("Flyway", "6.1.3") {
|
||||
library("Flyway", "6.2.0") {
|
||||
group("org.flywaydb") {
|
||||
modules = [
|
||||
"flyway-core"
|
||||
|
||||
Reference in New Issue
Block a user