Add liquibase test rollback on update property
See gh-13159
This commit is contained in:
committed by
Stephane Nicoll
parent
b839c98de9
commit
08279c889c
@@ -129,6 +129,7 @@ public class LiquibaseAutoConfiguration {
|
||||
liquibase.setLabels(this.properties.getLabels());
|
||||
liquibase.setChangeLogParameters(this.properties.getParameters());
|
||||
liquibase.setRollbackFile(this.properties.getRollbackFile());
|
||||
liquibase.setTestRollbackOnUpdate(this.properties.isTestRollbackOnUpdate());
|
||||
return liquibase;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
@@ -94,6 +94,11 @@ public class LiquibaseProperties {
|
||||
*/
|
||||
private File rollbackFile;
|
||||
|
||||
/**
|
||||
* Whether rollback should be tested before update is performed.
|
||||
*/
|
||||
private boolean testRollbackOnUpdate;
|
||||
|
||||
public String getChangeLog() {
|
||||
return this.changeLog;
|
||||
}
|
||||
@@ -191,4 +196,11 @@ public class LiquibaseProperties {
|
||||
this.rollbackFile = rollbackFile;
|
||||
}
|
||||
|
||||
public boolean isTestRollbackOnUpdate() {
|
||||
return this.testRollbackOnUpdate;
|
||||
}
|
||||
|
||||
public void setTestRollbackOnUpdate(boolean testRollbackOnUpdate) {
|
||||
this.testRollbackOnUpdate = testRollbackOnUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,6 +238,17 @@ public class LiquibaseAutoConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRollbackOnUpdate() throws IOException {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues(
|
||||
"spring.liquibase.test-rollback-on-update:true")
|
||||
.run((context) -> {
|
||||
SpringLiquibase liquibase = context.getBean(SpringLiquibase.class);
|
||||
assertThat(liquibase.isTestRollbackOnUpdate());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void liquibaseDataSource() {
|
||||
this.contextRunner.withUserConfiguration(LiquibaseDataSourceConfiguration.class,
|
||||
|
||||
Reference in New Issue
Block a user