Skip to content

Commit 77dbe99

Browse files
committed
Polish "Add clearChecksums to Liquibase auto-configuration"
See gh-20417
1 parent a2680ef commit 77dbe99

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

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
@@ -101,14 +101,14 @@ public SpringLiquibase liquibase(DataSourceProperties dataSourceProperties,
101101
SpringLiquibase liquibase = createSpringLiquibase(liquibaseDataSource.getIfAvailable(),
102102
dataSource.getIfUnique(), dataSourceProperties);
103103
liquibase.setChangeLog(this.properties.getChangeLog());
104+
liquibase.setClearCheckSums(this.properties.isClearChecksums());
104105
liquibase.setContexts(this.properties.getContexts());
105106
liquibase.setDefaultSchema(this.properties.getDefaultSchema());
106107
liquibase.setLiquibaseSchema(this.properties.getLiquibaseSchema());
107108
liquibase.setLiquibaseTablespace(this.properties.getLiquibaseTablespace());
108109
liquibase.setDatabaseChangeLogTable(this.properties.getDatabaseChangeLogTable());
109110
liquibase.setDatabaseChangeLogLockTable(this.properties.getDatabaseChangeLogLockTable());
110111
liquibase.setDropFirst(this.properties.isDropFirst());
111-
liquibase.setClearCheckSums(this.properties.isClearCheckSums());
112112
liquibase.setShouldRun(this.properties.isEnabled());
113113
liquibase.setLabels(this.properties.getLabels());
114114
liquibase.setChangeLogParameters(this.properties.getParameters());

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ public class LiquibaseProperties {
4040
*/
4141
private String changeLog = "classpath:/db/changelog/db.changelog-master.yaml";
4242

43+
/**
44+
* Whether to clear all checksums in the current changelog, so they will be
45+
* recalculated upon the next update.
46+
*/
47+
private boolean clearChecksums;
48+
4349
/**
4450
* Comma-separated list of runtime contexts to use.
4551
*/
@@ -75,12 +81,6 @@ public class LiquibaseProperties {
7581
*/
7682
private boolean dropFirst;
7783

78-
/**
79-
* Whether to clear all checksums in the current changelog, so they will be
80-
* recalculated next update.
81-
*/
82-
private boolean clearCheckSums;
83-
8484
/**
8585
* Whether to enable Liquibase support.
8686
*/
@@ -194,12 +194,12 @@ public void setDropFirst(boolean dropFirst) {
194194
this.dropFirst = dropFirst;
195195
}
196196

197-
public boolean isClearCheckSums() {
198-
return this.clearCheckSums;
197+
public boolean isClearChecksums() {
198+
return this.clearChecksums;
199199
}
200200

201-
public void setClearCheckSums(boolean clearCheckSums) {
202-
this.clearCheckSums = clearCheckSums;
201+
public void setClearChecksums(boolean clearChecksums) {
202+
this.clearChecksums = clearChecksums;
203203
}
204204

205205
public boolean isEnabled() {

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void defaultValues() {
145145
assertThat(liquibase.getDatabaseChangeLogLockTable())
146146
.isEqualTo(properties.getDatabaseChangeLogLockTable());
147147
assertThat(liquibase.isDropFirst()).isEqualTo(properties.isDropFirst());
148-
assertThat(liquibase.isClearCheckSums()).isEqualTo(properties.isClearCheckSums());
148+
assertThat(liquibase.isClearCheckSums()).isEqualTo(properties.isClearChecksums());
149149
assertThat(liquibase.isTestRollbackOnUpdate()).isEqualTo(properties.isTestRollbackOnUpdate());
150150
}));
151151
}
@@ -193,9 +193,9 @@ void overrideDropFirst() {
193193
}
194194

195195
@Test
196-
void overrideClearCheckSums() {
196+
void overrideClearChecksums() {
197197
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
198-
.withPropertyValues("spring.liquibase.clear-check-sums:true")
198+
.withPropertyValues("spring.liquibase.clear-checksums:true")
199199
.run(assertLiquibase((liquibase) -> assertThat(liquibase.isClearCheckSums()).isTrue()));
200200
}
201201

0 commit comments

Comments
 (0)