Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -218,6 +218,8 @@ private void configureProperties(FluentConfiguration configuration, FlywayProper
.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) {
Expand All @@ -243,6 +245,15 @@ private void configureJavaMigrations(FluentConfiguration flyway, List<JavaMigrat
}
}

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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -549,6 +555,14 @@ public void setIgnoreFutureMigrations(boolean ignoreFutureMigrations) {
this.ignoreFutureMigrations = ignoreFutureMigrations;
}

public boolean isValidateMigrationNaming() {
return this.validateMigrationNaming;
}

public void setValidateMigrationNaming(boolean validateMigrationNaming) {
this.validateMigrationNaming = validateMigrationNaming;
}

public boolean isMixed() {
return this.mixed;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -80,6 +80,7 @@ void defaultValuesAreConsistent() {
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());
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-project/spring-boot-dependencies/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ bom {
]
}
}
library("Flyway", "6.1.3") {
library("Flyway", "6.2.0") {
group("org.flywaydb") {
modules = [
"flyway-core"
Expand Down