Polish "Add clearChecksums to Liquibase auto-configuration"
See gh-20417
This commit is contained in:
@@ -101,6 +101,7 @@ public class LiquibaseAutoConfiguration {
|
||||
SpringLiquibase liquibase = createSpringLiquibase(liquibaseDataSource.getIfAvailable(),
|
||||
dataSource.getIfUnique(), dataSourceProperties);
|
||||
liquibase.setChangeLog(this.properties.getChangeLog());
|
||||
liquibase.setClearCheckSums(this.properties.isClearChecksums());
|
||||
liquibase.setContexts(this.properties.getContexts());
|
||||
liquibase.setDefaultSchema(this.properties.getDefaultSchema());
|
||||
liquibase.setLiquibaseSchema(this.properties.getLiquibaseSchema());
|
||||
@@ -108,7 +109,6 @@ public class LiquibaseAutoConfiguration {
|
||||
liquibase.setDatabaseChangeLogTable(this.properties.getDatabaseChangeLogTable());
|
||||
liquibase.setDatabaseChangeLogLockTable(this.properties.getDatabaseChangeLogLockTable());
|
||||
liquibase.setDropFirst(this.properties.isDropFirst());
|
||||
liquibase.setClearCheckSums(this.properties.isClearCheckSums());
|
||||
liquibase.setShouldRun(this.properties.isEnabled());
|
||||
liquibase.setLabels(this.properties.getLabels());
|
||||
liquibase.setChangeLogParameters(this.properties.getParameters());
|
||||
|
||||
@@ -40,6 +40,12 @@ public class LiquibaseProperties {
|
||||
*/
|
||||
private String changeLog = "classpath:/db/changelog/db.changelog-master.yaml";
|
||||
|
||||
/**
|
||||
* Whether to clear all checksums in the current changelog, so they will be
|
||||
* recalculated upon the next update.
|
||||
*/
|
||||
private boolean clearChecksums;
|
||||
|
||||
/**
|
||||
* Comma-separated list of runtime contexts to use.
|
||||
*/
|
||||
@@ -75,12 +81,6 @@ public class LiquibaseProperties {
|
||||
*/
|
||||
private boolean dropFirst;
|
||||
|
||||
/**
|
||||
* Whether to clear all checksums in the current changelog, so they will be
|
||||
* recalculated next update.
|
||||
*/
|
||||
private boolean clearCheckSums;
|
||||
|
||||
/**
|
||||
* Whether to enable Liquibase support.
|
||||
*/
|
||||
@@ -194,12 +194,12 @@ public class LiquibaseProperties {
|
||||
this.dropFirst = dropFirst;
|
||||
}
|
||||
|
||||
public boolean isClearCheckSums() {
|
||||
return this.clearCheckSums;
|
||||
public boolean isClearChecksums() {
|
||||
return this.clearChecksums;
|
||||
}
|
||||
|
||||
public void setClearCheckSums(boolean clearCheckSums) {
|
||||
this.clearCheckSums = clearCheckSums;
|
||||
public void setClearChecksums(boolean clearChecksums) {
|
||||
this.clearChecksums = clearChecksums;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
|
||||
@@ -145,7 +145,7 @@ class LiquibaseAutoConfigurationTests {
|
||||
assertThat(liquibase.getDatabaseChangeLogLockTable())
|
||||
.isEqualTo(properties.getDatabaseChangeLogLockTable());
|
||||
assertThat(liquibase.isDropFirst()).isEqualTo(properties.isDropFirst());
|
||||
assertThat(liquibase.isClearCheckSums()).isEqualTo(properties.isClearCheckSums());
|
||||
assertThat(liquibase.isClearCheckSums()).isEqualTo(properties.isClearChecksums());
|
||||
assertThat(liquibase.isTestRollbackOnUpdate()).isEqualTo(properties.isTestRollbackOnUpdate());
|
||||
}));
|
||||
}
|
||||
@@ -193,9 +193,9 @@ class LiquibaseAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void overrideClearCheckSums() {
|
||||
void overrideClearChecksums() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.liquibase.clear-check-sums:true")
|
||||
.withPropertyValues("spring.liquibase.clear-checksums:true")
|
||||
.run(assertLiquibase((liquibase) -> assertThat(liquibase.isClearCheckSums()).isTrue()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user