Skip to content

Commit c720db9

Browse files
Fixing compatibility with Flyway 6
1 parent 997aeba commit c720db9

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
<dependency>
135135
<groupId>org.flywaydb</groupId>
136136
<artifactId>flyway-core</artifactId>
137-
<version>5.0.7</version>
137+
<version>6.0.8</version>
138138
<optional>true</optional>
139139
</dependency>
140140
<dependency>

src/main/java/io/zonky/test/db/postgres/embedded/FlywayPreparer.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,32 @@
2121
import javax.sql.DataSource;
2222

2323
import org.flywaydb.core.Flyway;
24+
import org.flywaydb.core.api.configuration.FluentConfiguration;
2425

2526
// TODO: Detect missing migration files.
2627
// cf. https://github.com/flyway/flyway/issues/1496
2728
// There is also a related @Ignored test in otj-sql.
2829

2930
public final class FlywayPreparer implements DatabasePreparer {
3031

31-
private final Flyway flyway;
32+
private final FluentConfiguration flyway;
3233
private final List<String> locations;
3334

3435
public static FlywayPreparer forClasspathLocation(String... locations) {
35-
Flyway f = new Flyway();
36-
f.setLocations(locations);
36+
FluentConfiguration f = Flyway.configure()
37+
.locations(locations);
3738
return new FlywayPreparer(f, Arrays.asList(locations));
3839
}
3940

40-
private FlywayPreparer(Flyway flyway, List<String> locations) {
41+
private FlywayPreparer(FluentConfiguration flyway, List<String> locations) {
4142
this.flyway = flyway;
4243
this.locations = locations;
4344
}
4445

4546
@Override
4647
public void prepare(DataSource ds) throws SQLException {
47-
flyway.setDataSource(ds);
48-
flyway.migrate();
48+
flyway.dataSource(ds);
49+
flyway.load().migrate();
4950
}
5051

5152
@Override

0 commit comments

Comments
 (0)