Merge pull request #13159 from vkiriushkin:master
* pr/13159: Polish "Add liquibase test rollback on update property" Add liquibase test rollback on update property
This commit is contained in:
@@ -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,12 @@ public class LiquibaseProperties {
|
||||
this.rollbackFile = rollbackFile;
|
||||
}
|
||||
|
||||
public boolean isTestRollbackOnUpdate() {
|
||||
return this.testRollbackOnUpdate;
|
||||
}
|
||||
|
||||
public void setTestRollbackOnUpdate(boolean testRollbackOnUpdate) {
|
||||
this.testRollbackOnUpdate = testRollbackOnUpdate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -178,6 +178,18 @@ public class LiquibaseAutoConfigurationTests {
|
||||
}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void overrideTestRollbackOnUpdate() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues(
|
||||
"spring.liquibase.test-rollback-on-update:true")
|
||||
.run((context) -> {
|
||||
SpringLiquibase liquibase = context.getBean(SpringLiquibase.class);
|
||||
assertThat(liquibase.isTestRollbackOnUpdate()).isTrue();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void changeLogDoesNotExist() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
|
||||
@@ -567,6 +567,7 @@ content into your application. Rather, pick only the properties that you need.
|
||||
spring.liquibase.parameters.*= # Change log parameters.
|
||||
spring.liquibase.password= # Login password of the database to migrate.
|
||||
spring.liquibase.rollback-file= # File to which rollback SQL is written when an update is performed.
|
||||
spring.liquibase.test-rollback-on-update=false # Whether rollback should be tested before update is performed.
|
||||
spring.liquibase.url= # JDBC URL of the database to migrate. If not set, the primary configured data source is used.
|
||||
spring.liquibase.user= # Login user of the database to migrate.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user