Add support for configuring Liquibase tag property

See gh-19316
pull/20210/head
Eddú Meléndez 5 years ago committed by Stephane Nicoll
parent 5cb24c2584
commit 407e237f10

@ -112,6 +112,7 @@ public class LiquibaseAutoConfiguration {
liquibase.setChangeLogParameters(this.properties.getParameters());
liquibase.setRollbackFile(this.properties.getRollbackFile());
liquibase.setTestRollbackOnUpdate(this.properties.isTestRollbackOnUpdate());
liquibase.setTag(this.properties.getTag());
return liquibase;
}

@ -28,6 +28,7 @@ import org.springframework.util.Assert;
* Configuration properties to configure {@link SpringLiquibase}.
*
* @author Marcel Overdijk
* @author Eddú Meléndez
* @since 1.1.0
*/
@ConfigurationProperties(prefix = "spring.liquibase", ignoreUnknownFields = false)
@ -114,6 +115,11 @@ public class LiquibaseProperties {
*/
private boolean testRollbackOnUpdate;
/**
* Name of the tag.
*/
private String tag;
public String getChangeLog() {
return this.changeLog;
}
@ -243,4 +249,12 @@ public class LiquibaseProperties {
this.testRollbackOnUpdate = testRollbackOnUpdate;
}
public String getTag() {
return this.tag;
}
public void setTag(String tag) {
this.tag = tag;
}
}

@ -343,6 +343,13 @@ class LiquibaseAutoConfigurationTests {
});
}
@Test
void overrideTag() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.liquibase.tag:1.0.0")
.run(assertLiquibase((liquibase) -> assertThat(liquibase.getTag()).isEqualTo("1.0.0")));
}
private ContextConsumer<AssertableApplicationContext> assertLiquibase(Consumer<SpringLiquibase> consumer) {
return (context) -> {
assertThat(context).hasSingleBean(SpringLiquibase.class);

Loading…
Cancel
Save