Skip to content

Commit 92fa90a

Browse files
authored
Merge pull request #150 from zonkyio/flyway-7.5.1
#149 Fix breaking changes in flyway 7.5.1
2 parents 59be753 + 22054ec commit 92fa90a

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ ext {
4040
[core: '7.3.2', test: '7.0.0'],
4141
[core: '7.4.0', test: '7.0.0'],
4242
[core: '7.5.0', test: '7.0.0'],
43+
[core: '7.5.1', test: '7.0.0'],
44+
[core: '7.5.2', test: '7.0.0'],
4345

4446
[core: '5.0.7', test: '5.0.0'] // default version
4547
]

embedded-database-spring-test/src/main/java/io/zonky/test/db/flyway/FlywayConfigSnapshot.java

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.flywaydb.core.Flyway;
66
import org.flywaydb.core.api.MigrationVersion;
77
import org.flywaydb.core.api.resolver.MigrationResolver;
8+
import org.springframework.util.ClassUtils;
89

910
import javax.sql.DataSource;
1011
import java.util.Arrays;
@@ -99,7 +100,6 @@ public class FlywayConfigSnapshot {
99100
private final String conjurToken;
100101
private final String vaultUrl;
101102
private final String vaultToken;
102-
private final String vaultSecret;
103103
private final List<String> vaultSecrets;
104104

105105
public FlywayConfigSnapshot(Flyway flyway) {
@@ -305,28 +305,23 @@ public FlywayConfigSnapshot(Flyway flyway) {
305305
this.lockRetryCount = 50;
306306
}
307307

308-
if (flywayVersion >= 74) {
308+
if (flywayVersion >= 74 && isFlywayPro) {
309309
this.conjurUrl = getValue(config, "getConjurUrl");
310310
this.conjurToken = getValue(config, "getConjurToken");
311311
this.vaultUrl = getValue(config, "getVaultUrl");
312312
this.vaultToken = getValue(config, "getVaultToken");
313+
314+
if (ClassUtils.hasMethod(config.getClass(), "getVaultSecret")) {
315+
this.vaultSecrets = ImmutableList.of(getValue(config, "getVaultSecret"));
316+
} else {
317+
this.vaultSecrets = ImmutableList.copyOf(getArray(config, "getVaultSecrets"));
318+
}
313319
} else {
314320
this.conjurUrl = null;
315321
this.conjurToken = null;
316322
this.vaultUrl = null;
317323
this.vaultToken = null;
318-
}
319-
320-
if (flywayVersion >= 74 && flywayVersion < 76) {
321-
this.vaultSecret = getValue(config, "getVaultSecret");
322-
} else {
323-
this.vaultSecret = null;
324-
}
325-
326-
if (flywayVersion >= 76) {
327-
this.vaultSecrets = ImmutableList.copyOf(getArray(config, "getVaultSecrets"));
328-
} else {
329-
this.vaultSecrets = ImmutableList.of();;
324+
this.vaultSecrets = ImmutableList.of();
330325
}
331326
}
332327

@@ -606,10 +601,6 @@ public String getVaultToken() {
606601
return vaultToken;
607602
}
608603

609-
public String getVaultSecret() {
610-
return vaultSecret;
611-
}
612-
613604
public List<String> getVaultSecrets() {
614605
return vaultSecrets;
615606
}
@@ -682,7 +673,6 @@ public boolean equals(Object o) {
682673
Objects.equals(conjurToken, that.conjurToken) &&
683674
Objects.equals(vaultUrl, that.vaultUrl) &&
684675
Objects.equals(vaultToken, that.vaultToken) &&
685-
Objects.equals(vaultSecret, that.vaultSecret) &&
686676
Objects.equals(vaultSecrets, that.vaultSecrets);
687677
}
688678

@@ -704,6 +694,6 @@ public int hashCode() {
704694
mixed, group, installedBy, dryRun, stream, batch,
705695
oracleSqlPlus, oracleSqlplusWarn, oracleKerberosConfigFile, oracleKerberosCacheFile,
706696
outputQueryResults, connectRetries, lockRetryCount,
707-
conjurUrl, conjurToken, vaultUrl, vaultToken, vaultSecret, vaultSecrets);
697+
conjurUrl, conjurToken, vaultUrl, vaultToken, vaultSecrets);
708698
}
709699
}

0 commit comments

Comments
 (0)