mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Reinstate leading / in default value for spring.liquibase.change-log
Unfortunately, while redundant for new applications, removing the leading slash adversely affected existing application upon upgrades as it caused Liquibase to re-apply every change log. Closes gh-20177
This commit is contained in:
parent
d9d6cb6f1f
commit
c917b61484
@ -104,10 +104,10 @@ class LiquibaseEndpointTests {
|
||||
.liquibaseBeans().getContexts().get(context.getId()).getLiquibaseBeans();
|
||||
assertThat(liquibaseBeans.get("liquibase").getChangeSets()).hasSize(1);
|
||||
assertThat(liquibaseBeans.get("liquibase").getChangeSets().get(0).getChangeLog())
|
||||
.isEqualTo("classpath:db/changelog/db.changelog-master.yaml");
|
||||
.isEqualTo("classpath:/db/changelog/db.changelog-master.yaml");
|
||||
assertThat(liquibaseBeans.get("liquibaseBackup").getChangeSets()).hasSize(1);
|
||||
assertThat(liquibaseBeans.get("liquibaseBackup").getChangeSets().get(0).getChangeLog())
|
||||
.isEqualTo("classpath:db/changelog/db.changelog-master-backup.yaml");
|
||||
.isEqualTo("classpath:/db/changelog/db.changelog-master-backup.yaml");
|
||||
});
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ class LiquibaseEndpointTests {
|
||||
|
||||
private SpringLiquibase createSpringLiquibase(String changeLog, DataSource dataSource) {
|
||||
SpringLiquibase liquibase = new SpringLiquibase();
|
||||
liquibase.setChangeLog("classpath:db/changelog/" + changeLog);
|
||||
liquibase.setChangeLog("classpath:/db/changelog/" + changeLog);
|
||||
liquibase.setShouldRun(true);
|
||||
liquibase.setDataSource(dataSource);
|
||||
return liquibase;
|
||||
|
@ -37,7 +37,7 @@ public class LiquibaseProperties {
|
||||
/**
|
||||
* Change log configuration path.
|
||||
*/
|
||||
private String changeLog = "classpath:db/changelog/db.changelog-master.yaml";
|
||||
private String changeLog = "classpath:/db/changelog/db.changelog-master.yaml";
|
||||
|
||||
/**
|
||||
* Comma-separated list of runtime contexts to use.
|
||||
|
@ -1105,7 +1105,7 @@
|
||||
"name": "liquibase.change-log",
|
||||
"type": "java.lang.String",
|
||||
"description": "Change log configuration path.",
|
||||
"defaultValue": "classpath:db/changelog/db.changelog-master.yaml",
|
||||
"defaultValue": "classpath:/db/changelog/db.changelog-master.yaml",
|
||||
"deprecation": {
|
||||
"replacement": "spring.liquibase.change-log",
|
||||
"level": "error"
|
||||
|
@ -102,7 +102,7 @@ class LiquibaseAutoConfigurationTests {
|
||||
void defaultSpringLiquibase() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.run(assertLiquibase((liquibase) -> {
|
||||
assertThat(liquibase.getChangeLog()).isEqualTo("classpath:db/changelog/db.changelog-master.yaml");
|
||||
assertThat(liquibase.getChangeLog()).isEqualTo("classpath:/db/changelog/db.changelog-master.yaml");
|
||||
assertThat(liquibase.getContexts()).isNull();
|
||||
assertThat(liquibase.getDefaultSchema()).isNull();
|
||||
assertThat(liquibase.isDropFirst()).isFalse();
|
||||
@ -112,26 +112,26 @@ class LiquibaseAutoConfigurationTests {
|
||||
@Test
|
||||
void changelogXml() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.liquibase.change-log:classpath:db/changelog/db.changelog-override.xml")
|
||||
.withPropertyValues("spring.liquibase.change-log:classpath:/db/changelog/db.changelog-override.xml")
|
||||
.run(assertLiquibase((liquibase) -> assertThat(liquibase.getChangeLog())
|
||||
.isEqualTo("classpath:db/changelog/db.changelog-override.xml")));
|
||||
.isEqualTo("classpath:/db/changelog/db.changelog-override.xml")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void changelogJson() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.liquibase.change-log:classpath:db/changelog/db.changelog-override.json")
|
||||
.withPropertyValues("spring.liquibase.change-log:classpath:/db/changelog/db.changelog-override.json")
|
||||
.run(assertLiquibase((liquibase) -> assertThat(liquibase.getChangeLog())
|
||||
.isEqualTo("classpath:db/changelog/db.changelog-override.json")));
|
||||
.isEqualTo("classpath:/db/changelog/db.changelog-override.json")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnabledOnJre(JRE.JAVA_8)
|
||||
void changelogSql() {
|
||||
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.liquibase.change-log:classpath:db/changelog/db.changelog-override.sql")
|
||||
.withPropertyValues("spring.liquibase.change-log:classpath:/db/changelog/db.changelog-override.sql")
|
||||
.run(assertLiquibase((liquibase) -> assertThat(liquibase.getChangeLog())
|
||||
.isEqualTo("classpath:db/changelog/db.changelog-override.sql")));
|
||||
.isEqualTo("classpath:/db/changelog/db.changelog-override.sql")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -381,7 +381,7 @@ class LiquibaseAutoConfigurationTests {
|
||||
@Bean
|
||||
SpringLiquibase springLiquibase(DataSource dataSource) {
|
||||
SpringLiquibase liquibase = new SpringLiquibase();
|
||||
liquibase.setChangeLog("classpath:db/changelog/db.changelog-master.yaml");
|
||||
liquibase.setChangeLog("classpath:/db/changelog/db.changelog-master.yaml");
|
||||
liquibase.setShouldRun(true);
|
||||
liquibase.setDataSource(dataSource);
|
||||
return liquibase;
|
||||
|
@ -59,10 +59,10 @@ class SampleLiquibaseApplicationTests {
|
||||
assertThat(output).contains("Successfully acquired change log lock")
|
||||
.contains("Creating database history table with name: PUBLIC.DATABASECHANGELOG")
|
||||
.contains("Table person created")
|
||||
.contains("ChangeSet classpath:db/changelog/db.changelog-master.yaml::1::"
|
||||
.contains("ChangeSet classpath:/db/changelog/db.changelog-master.yaml::1::"
|
||||
+ "marceloverdijk ran successfully")
|
||||
.contains("New row inserted into person")
|
||||
.contains("ChangeSet classpath:db/changelog/"
|
||||
.contains("ChangeSet classpath:/db/changelog/"
|
||||
+ "db.changelog-master.yaml::2::marceloverdijk ran successfully")
|
||||
.contains("Successfully released change log lock");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user