Skip to content

Commit a8705d1

Browse files
committed
Upgrade to Flyway 7.1.1
Closes gh-23932
1 parent 7b4d261 commit a8705d1

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ private void configureProperties(FluentConfiguration configuration, FlywayProper
173173
map.from(locations).to(configuration::locations);
174174
map.from(properties.getEncoding()).to(configuration::encoding);
175175
map.from(properties.getConnectRetries()).to(configuration::connectRetries);
176+
// No method reference for compatibility with Flyway 6.x
177+
map.from(properties.getLockRetryCount())
178+
.to((lockRetryCount) -> configuration.lockRetryCount(lockRetryCount));
176179
// No method reference for compatibility with Flyway 5.x
177180
map.from(properties.getDefaultSchema()).to((schema) -> configuration.defaultSchema(schema));
178181
map.from(properties.getSchemas()).as(StringUtils::toStringArray).to(configuration::schemas);

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ public class FlywayProperties {
6464
*/
6565
private int connectRetries;
6666

67+
/**
68+
* Maximum number of retries when trying to obtain a lock.
69+
*/
70+
private Integer lockRetryCount;
71+
6772
/**
6873
* Default schema name managed by Flyway (case-sensitive).
6974
*/
@@ -363,6 +368,14 @@ public void setConnectRetries(int connectRetries) {
363368
this.connectRetries = connectRetries;
364369
}
365370

371+
public Integer getLockRetryCount() {
372+
return this.lockRetryCount;
373+
}
374+
375+
public void setLockRetryCount(Integer lockRetryCount) {
376+
this.lockRetryCount = lockRetryCount;
377+
}
378+
366379
public String getDefaultSchema() {
367380
return this.defaultSchema;
368381
}

spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,10 @@
856856
"classpath:db/migration"
857857
]
858858
},
859+
{
860+
"name": "spring.flyway.lock-retry-count",
861+
"defaultValue": 50
862+
},
859863
{
860864
"name": "spring.flyway.sql-migration-suffix",
861865
"type": "java.lang.String",

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayPropertiesTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ void defaultValuesAreConsistent() {
5151
.isEqualTo(configuration.getLocations());
5252
assertThat(properties.getEncoding()).isEqualTo(configuration.getEncoding());
5353
assertThat(properties.getConnectRetries()).isEqualTo(configuration.getConnectRetries());
54+
// Can't assert lock retry count default as it is new in Flyway 7.1
55+
// Asserting hard-coded value in the metadata instead
56+
assertThat(configuration.getLockRetryCount()).isEqualTo(50);
5457
assertThat(properties.getDefaultSchema()).isEqualTo(configuration.getDefaultSchema());
5558
assertThat(properties.getSchemas()).isEqualTo(Arrays.asList(configuration.getSchemas()));
5659
assertThat(properties.isCreateSchemas()).isEqualTo(configuration.getCreateSchemas());

spring-boot-project/spring-boot-dependencies/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ bom {
304304
]
305305
}
306306
}
307-
library("Flyway", "7.0.4") {
307+
library("Flyway", "7.1.1") {
308308
group("org.flywaydb") {
309309
modules = [
310310
"flyway-core"

0 commit comments

Comments
 (0)