Skip to content

Commit 1c38c23

Browse files
committed
Make check-location property consistent in Flyway and Liquibase
See gh-10464
1 parent 4e88546 commit 1c38c23

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* properties into the {@link Flyway} instance.
3232
*
3333
* @author Dave Syer
34+
* @author Eddú Meléndez
3435
* @since 1.1.0
3536
*/
3637
@ConfigurationProperties(prefix = "spring.flyway", ignoreUnknownFields = true)
@@ -46,7 +47,7 @@ public class FlywayProperties {
4647
/**
4748
* Check that migration scripts location exists.
4849
*/
49-
private boolean checkLocation = false;
50+
private boolean checkLocation = true;
5051

5152
/**
5253
* Enable flyway.

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public LiquibaseConfiguration(LiquibaseProperties properties,
9999

100100
@PostConstruct
101101
public void checkChangelogExists() {
102-
if (this.properties.isCheckChangeLogLocation()) {
102+
if (this.properties.isCheckLocation()) {
103103
Resource resource = this.resourceLoader
104104
.getResource(this.properties.getChangeLog());
105105
Assert.state(resource.exists(),

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* Configuration properties to configure {@link SpringLiquibase}.
2929
*
3030
* @author Marcel Overdijk
31+
* @author Eddú Meléndez
3132
* @since 1.1.0
3233
*/
3334
@ConfigurationProperties(prefix = "spring.liquibase", ignoreUnknownFields = false)
@@ -41,7 +42,7 @@ public class LiquibaseProperties {
4142
/**
4243
* Check the change log location exists.
4344
*/
44-
private boolean checkChangeLogLocation = true;
45+
private boolean checkLocation = true;
4546

4647
/**
4748
* Comma-separated list of runtime contexts to use.
@@ -103,12 +104,12 @@ public void setChangeLog(String changeLog) {
103104
this.changeLog = changeLog;
104105
}
105106

106-
public boolean isCheckChangeLogLocation() {
107-
return this.checkChangeLogLocation;
107+
public boolean isCheckLocation() {
108+
return this.checkLocation;
108109
}
109110

110-
public void setCheckChangeLogLocation(boolean checkChangeLogLocation) {
111-
this.checkChangeLogLocation = checkChangeLogLocation;
111+
public void setCheckLocation(boolean checkLocation) {
112+
this.checkLocation = checkLocation;
112113
}
113114

114115
public String getContexts() {

spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@
686686
"description": "Check the change log location exists.",
687687
"defaultValue": true,
688688
"deprecation": {
689-
"replacement": "spring.liquibase.check-change-log-location",
689+
"replacement": "spring.liquibase.check-location",
690690
"level": "error"
691691
}
692692
},

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ public void changeLogDoesNotExist() {
173173
public void checkLocationsAllMissing() {
174174
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
175175
.withPropertyValues(
176-
"spring.flyway.locations:classpath:db/missing1,classpath:db/migration2",
177-
"spring.flyway.check-location:true")
176+
"spring.flyway.locations:classpath:db/missing1,classpath:db/migration2")
178177
.run((context) -> {
179178
assertThat(context).hasFailed();
180179
assertThat(context).getFailure()
@@ -188,8 +187,7 @@ public void checkLocationsAllMissing() {
188187
public void checkLocationsAllExist() {
189188
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
190189
.withPropertyValues(
191-
"spring.flyway.locations:classpath:db/changelog,classpath:db/migration",
192-
"spring.flyway.check-location:true")
190+
"spring.flyway.locations:classpath:db/changelog,classpath:db/migration")
193191
.run((context) -> assertThat(context).hasNotFailed());
194192
}
195193

spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ content into your application; rather pick only the properties that you need.
497497
spring.flyway.baseline-description= #
498498
spring.flyway.baseline-on-migrate= #
499499
spring.flyway.baseline-version=1 # version to start migration
500-
spring.flyway.check-location=false # Check that migration scripts location exists.
500+
spring.flyway.check-location=true # Check that migration scripts location exists.
501501
spring.flyway.clean-disabled= #
502502
spring.flyway.clean-on-validation-error= #
503503
spring.flyway.enabled=true # Enable flyway.
@@ -531,7 +531,7 @@ content into your application; rather pick only the properties that you need.
531531
532532
# LIQUIBASE ({sc-spring-boot-autoconfigure}/liquibase/LiquibaseProperties.{sc-ext}[LiquibaseProperties])
533533
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path.
534-
spring.liquibase.check-change-log-location=true # Check the change log location exists.
534+
spring.liquibase.check-location=true # Check the change log location exists.
535535
spring.liquibase.contexts= # Comma-separated list of runtime contexts to use.
536536
spring.liquibase.default-schema= # Default database schema.
537537
spring.liquibase.drop-first=false # Drop the database schema first.

0 commit comments

Comments
 (0)