mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Upgrade to Flyway 10.15.0
Closes gh-41217
This commit is contained in:
parent
6bdba8e69e
commit
5920b27b57
|
@ -302,6 +302,8 @@ public class FlywayAutoConfiguration {
|
||||||
.to((suffix) -> configuration.scriptPlaceholderSuffix(suffix));
|
.to((suffix) -> configuration.scriptPlaceholderSuffix(suffix));
|
||||||
configureExecuteInTransaction(configuration, properties, map);
|
configureExecuteInTransaction(configuration, properties, map);
|
||||||
map.from(properties::getLoggers).to((loggers) -> configuration.loggers(loggers));
|
map.from(properties::getLoggers).to((loggers) -> configuration.loggers(loggers));
|
||||||
|
map.from(properties::getCommunityDbSupportEnabled)
|
||||||
|
.to((communityDbSupportEnabled) -> configuration.communityDBSupportEnabled(communityDbSupportEnabled));
|
||||||
// Flyway Teams properties
|
// Flyway Teams properties
|
||||||
map.from(properties.getBatch()).to((batch) -> configuration.batch(batch));
|
map.from(properties.getBatch()).to((batch) -> configuration.batch(batch));
|
||||||
map.from(properties.getDryRunOutput()).to((dryRunOutput) -> configuration.dryRunOutput(dryRunOutput));
|
map.from(properties.getDryRunOutput()).to((dryRunOutput) -> configuration.dryRunOutput(dryRunOutput));
|
||||||
|
|
|
@ -330,6 +330,11 @@ public class FlywayProperties {
|
||||||
*/
|
*/
|
||||||
private Boolean detectEncoding;
|
private Boolean detectEncoding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to enable community database support.
|
||||||
|
*/
|
||||||
|
private Boolean communityDbSupportEnabled;
|
||||||
|
|
||||||
private final Oracle oracle = new Oracle();
|
private final Oracle oracle = new Oracle();
|
||||||
|
|
||||||
private final Postgresql postgresql = new Postgresql();
|
private final Postgresql postgresql = new Postgresql();
|
||||||
|
@ -823,6 +828,14 @@ public class FlywayProperties {
|
||||||
this.detectEncoding = detectEncoding;
|
this.detectEncoding = detectEncoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getCommunityDbSupportEnabled() {
|
||||||
|
return this.communityDbSupportEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommunityDbSupportEnabled(Boolean communityDbSupportEnabled) {
|
||||||
|
this.communityDbSupportEnabled = communityDbSupportEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public Oracle getOracle() {
|
public Oracle getOracle() {
|
||||||
return this.oracle;
|
return this.oracle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1346,6 +1346,9 @@
|
||||||
"level": "error",
|
"level": "error",
|
||||||
"reason": "Removed in Flyway 10"
|
"reason": "Removed in Flyway 10"
|
||||||
}
|
}
|
||||||
|
},{
|
||||||
|
"name": "spring.flyway.community-db-support-enabled",
|
||||||
|
"defaultValue": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "spring.flyway.dry-run-output",
|
"name": "spring.flyway.dry-run-output",
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012-2024 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.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.springframework.boot.autoconfigure.flyway;
|
||||||
|
|
||||||
|
import org.flywaydb.core.Flyway;
|
||||||
|
import org.flywaydb.core.api.Location;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||||
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||||
|
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
|
||||||
|
import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for {@link FlywayAutoConfiguration} with Flyway 10.0.
|
||||||
|
*
|
||||||
|
* @author Andy Wilkinson
|
||||||
|
*/
|
||||||
|
@ClassPathExclusions({ "flyway-core-*.jar", "flyway-sqlserver-*.jar" })
|
||||||
|
@ClassPathOverrides({ "org.flywaydb:flyway-core:10.0.0", "com.h2database:h2:2.1.210" })
|
||||||
|
class Flyway100AutoConfigurationTests {
|
||||||
|
|
||||||
|
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||||
|
.withConfiguration(AutoConfigurations.of(FlywayAutoConfiguration.class))
|
||||||
|
.withPropertyValues("spring.datasource.generate-unique-name=true");
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void defaultFlyway() {
|
||||||
|
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class).run((context) -> {
|
||||||
|
assertThat(context).hasSingleBean(Flyway.class);
|
||||||
|
Flyway flyway = context.getBean(Flyway.class);
|
||||||
|
assertThat(flyway.getConfiguration().getLocations())
|
||||||
|
.containsExactly(new Location("classpath:db/migration"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -93,6 +93,7 @@ class FlywayPropertiesTests {
|
||||||
assertThat(properties.getScriptPlaceholderPrefix()).isEqualTo(configuration.getScriptPlaceholderPrefix());
|
assertThat(properties.getScriptPlaceholderPrefix()).isEqualTo(configuration.getScriptPlaceholderPrefix());
|
||||||
assertThat(properties.getScriptPlaceholderSuffix()).isEqualTo(configuration.getScriptPlaceholderSuffix());
|
assertThat(properties.getScriptPlaceholderSuffix()).isEqualTo(configuration.getScriptPlaceholderSuffix());
|
||||||
assertThat(properties.isExecuteInTransaction()).isEqualTo(configuration.isExecuteInTransaction());
|
assertThat(properties.isExecuteInTransaction()).isEqualTo(configuration.isExecuteInTransaction());
|
||||||
|
assertThat(properties.getCommunityDbSupportEnabled()).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -140,6 +141,7 @@ class FlywayPropertiesTests {
|
||||||
ignoreProperties(configuration, "failOnMissingTarget");
|
ignoreProperties(configuration, "failOnMissingTarget");
|
||||||
// Properties managed by a proprietary extension
|
// Properties managed by a proprietary extension
|
||||||
ignoreProperties(configuration, "cherryPick");
|
ignoreProperties(configuration, "cherryPick");
|
||||||
|
aliasProperty(configuration, "communityDBSupportEnabled", "communityDbSupportEnabled");
|
||||||
List<String> configurationKeys = new ArrayList<>(configuration.keySet());
|
List<String> configurationKeys = new ArrayList<>(configuration.keySet());
|
||||||
Collections.sort(configurationKeys);
|
Collections.sort(configurationKeys);
|
||||||
List<String> propertiesKeys = new ArrayList<>(properties.keySet());
|
List<String> propertiesKeys = new ArrayList<>(properties.keySet());
|
||||||
|
@ -154,6 +156,12 @@ class FlywayPropertiesTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void aliasProperty(Map<String, PropertyDescriptor> index, String originalName, String alias) {
|
||||||
|
PropertyDescriptor descriptor = index.remove(originalName);
|
||||||
|
assertThat(descriptor).describedAs("Property to alias should be present " + originalName).isNotNull();
|
||||||
|
index.put(alias, descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, PropertyDescriptor> indexProperties(BeanWrapper beanWrapper) {
|
private Map<String, PropertyDescriptor> indexProperties(BeanWrapper beanWrapper) {
|
||||||
Map<String, PropertyDescriptor> descriptor = new HashMap<>();
|
Map<String, PropertyDescriptor> descriptor = new HashMap<>();
|
||||||
for (PropertyDescriptor propertyDescriptor : beanWrapper.getPropertyDescriptors()) {
|
for (PropertyDescriptor propertyDescriptor : beanWrapper.getPropertyDescriptors()) {
|
||||||
|
|
|
@ -373,7 +373,7 @@ bom {
|
||||||
releaseNotes("https://www.elastic.co/guide/en/elasticsearch/reference/current/release-notes-{version}.html")
|
releaseNotes("https://www.elastic.co/guide/en/elasticsearch/reference/current/release-notes-{version}.html")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
library("Flyway", "10.10.0") {
|
library("Flyway", "10.15.0") {
|
||||||
group("org.flywaydb") {
|
group("org.flywaydb") {
|
||||||
modules = [
|
modules = [
|
||||||
"flyway-commandline",
|
"flyway-commandline",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user