From 2a371685213973189d3175ea576de93bb696f3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Tue, 22 Jul 2025 15:09:53 +0200 Subject: [PATCH] Upgrade to Flyway 11.10.3 Closes gh-46496 --- .../autoconfigure/FlywayAutoConfiguration.java | 2 ++ .../flyway/autoconfigure/FlywayProperties.java | 14 ++++++++++++++ .../FlywayAutoConfigurationTests.java | 8 ++++++++ .../autoconfigure/FlywayPropertiesTests.java | 1 + platform/spring-boot-dependencies/build.gradle | 2 +- 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/module/spring-boot-flyway/src/main/java/org/springframework/boot/flyway/autoconfigure/FlywayAutoConfiguration.java b/module/spring-boot-flyway/src/main/java/org/springframework/boot/flyway/autoconfigure/FlywayAutoConfiguration.java index abca594311d..62aa040607b 100644 --- a/module/spring-boot-flyway/src/main/java/org/springframework/boot/flyway/autoconfigure/FlywayAutoConfiguration.java +++ b/module/spring-boot-flyway/src/main/java/org/springframework/boot/flyway/autoconfigure/FlywayAutoConfiguration.java @@ -297,6 +297,8 @@ public class FlywayAutoConfiguration { .to((prefix) -> configuration.scriptPlaceholderPrefix(prefix)); map.from(properties.getScriptPlaceholderSuffix()) .to((suffix) -> configuration.scriptPlaceholderSuffix(suffix)); + map.from(properties.getPowershellExecutable()) + .to((powershellExecutable) -> configuration.powershellExecutable(powershellExecutable)); configureExecuteInTransaction(configuration, properties, map); map.from(properties::getLoggers).to((loggers) -> configuration.loggers(loggers)); map.from(properties::getCommunityDbSupportEnabled) diff --git a/module/spring-boot-flyway/src/main/java/org/springframework/boot/flyway/autoconfigure/FlywayProperties.java b/module/spring-boot-flyway/src/main/java/org/springframework/boot/flyway/autoconfigure/FlywayProperties.java index e1754f32c63..ccb01d68570 100644 --- a/module/spring-boot-flyway/src/main/java/org/springframework/boot/flyway/autoconfigure/FlywayProperties.java +++ b/module/spring-boot-flyway/src/main/java/org/springframework/boot/flyway/autoconfigure/FlywayProperties.java @@ -258,6 +258,12 @@ public class FlywayProperties { */ private String scriptPlaceholderSuffix = "__"; + /** + * PowerShell executable to use for running PowerShell scripts. Default to + * "powershell" on Windows, "pwsh" on other platforms. + */ + private String powershellExecutable; + /** * Whether Flyway should execute SQL within a transaction. */ @@ -661,6 +667,14 @@ public class FlywayProperties { this.scriptPlaceholderSuffix = scriptPlaceholderSuffix; } + public String getPowershellExecutable() { + return this.powershellExecutable; + } + + public void setPowershellExecutable(String powershellExecutable) { + this.powershellExecutable = powershellExecutable; + } + public boolean isExecuteInTransaction() { return this.executeInTransaction; } diff --git a/module/spring-boot-flyway/src/test/java/org/springframework/boot/flyway/autoconfigure/FlywayAutoConfigurationTests.java b/module/spring-boot-flyway/src/test/java/org/springframework/boot/flyway/autoconfigure/FlywayAutoConfigurationTests.java index 302a447b7ca..2982b2f1c99 100644 --- a/module/spring-boot-flyway/src/test/java/org/springframework/boot/flyway/autoconfigure/FlywayAutoConfigurationTests.java +++ b/module/spring-boot-flyway/src/test/java/org/springframework/boot/flyway/autoconfigure/FlywayAutoConfigurationTests.java @@ -748,6 +748,14 @@ class FlywayAutoConfigurationTests { }); } + @Test + void powershellExecutableIsCorrectlyMapped() { + this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) + .withPropertyValues("spring.flyway.powershell-executable=my-pwsh") + .run((context) -> assertThat(context.getBean(Flyway.class).getConfiguration().getPowershellExecutable()) + .isEqualTo("my-pwsh")); + } + @Test void postgresqlExtensionIsNotLoadedByDefault() { FluentConfiguration configuration = mock(FluentConfiguration.class); diff --git a/module/spring-boot-flyway/src/test/java/org/springframework/boot/flyway/autoconfigure/FlywayPropertiesTests.java b/module/spring-boot-flyway/src/test/java/org/springframework/boot/flyway/autoconfigure/FlywayPropertiesTests.java index d971a93ce63..ce7d03b9365 100644 --- a/module/spring-boot-flyway/src/test/java/org/springframework/boot/flyway/autoconfigure/FlywayPropertiesTests.java +++ b/module/spring-boot-flyway/src/test/java/org/springframework/boot/flyway/autoconfigure/FlywayPropertiesTests.java @@ -71,6 +71,7 @@ class FlywayPropertiesTests { assertThat(properties.getPlaceholderPrefix()).isEqualToIgnoringWhitespace(configuration.getPlaceholderPrefix()); assertThat(properties.getPlaceholderSuffix()).isEqualTo(configuration.getPlaceholderSuffix()); assertThat(properties.isPlaceholderReplacement()).isEqualTo(configuration.isPlaceholderReplacement()); + assertThat(properties.getPowershellExecutable()).isEqualTo(configuration.getPowershellExecutable()); assertThat(properties.getSqlMigrationPrefix()).isEqualTo(configuration.getSqlMigrationPrefix()); assertThat(properties.getSqlMigrationSuffixes()).containsExactly(configuration.getSqlMigrationSuffixes()); assertThat(properties.getSqlMigrationSeparator()).isEqualTo(configuration.getSqlMigrationSeparator()); diff --git a/platform/spring-boot-dependencies/build.gradle b/platform/spring-boot-dependencies/build.gradle index 7f249e13710..9fabb2adf02 100644 --- a/platform/spring-boot-dependencies/build.gradle +++ b/platform/spring-boot-dependencies/build.gradle @@ -383,7 +383,7 @@ bom { javadoc("elasticsearch-rest-client-sniffer", version -> "https://artifacts.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client-sniffer/%s".formatted(version), "org.elasticsearch.client.sniff") } } - library("Flyway", "11.10.1") { + library("Flyway", "11.10.3") { group("org.flywaydb") { modules = [ "flyway-commandline",