diff --git a/pom.xml b/pom.xml
index 8ddb9352..2786d1a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -130,7 +130,7 @@
org.flywaydb
flyway-core
- 6.5.1
+ 7.1.1
true
diff --git a/src/main/java/io/zonky/test/db/postgres/embedded/FlywayPreparer.java b/src/main/java/io/zonky/test/db/postgres/embedded/FlywayPreparer.java
index 2e93ff9c..d36afcac 100644
--- a/src/main/java/io/zonky/test/db/postgres/embedded/FlywayPreparer.java
+++ b/src/main/java/io/zonky/test/db/postgres/embedded/FlywayPreparer.java
@@ -20,6 +20,7 @@
import javax.sql.DataSource;
+import org.apache.commons.lang3.reflect.MethodUtils;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.configuration.FluentConfiguration;
@@ -29,24 +30,28 @@
public final class FlywayPreparer implements DatabasePreparer {
- private final FluentConfiguration flyway;
+ private final FluentConfiguration configuration;
private final List locations;
public static FlywayPreparer forClasspathLocation(String... locations) {
- FluentConfiguration f = Flyway.configure()
- .locations(locations);
- return new FlywayPreparer(f, Arrays.asList(locations));
+ FluentConfiguration config = Flyway.configure().locations(locations);
+ return new FlywayPreparer(config, Arrays.asList(locations));
}
- private FlywayPreparer(FluentConfiguration flyway, List locations) {
- this.flyway = flyway;
+ private FlywayPreparer(FluentConfiguration configuration, List locations) {
+ this.configuration = configuration;
this.locations = locations;
}
@Override
public void prepare(DataSource ds) throws SQLException {
- flyway.dataSource(ds);
- flyway.load().migrate();
+ configuration.dataSource(ds);
+ Flyway flyway = configuration.load();
+ try {
+ MethodUtils.invokeMethod(flyway, "migrate");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@Override