Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Fix postgres migration test failure
Browse files Browse the repository at this point in the history
Using `CREATE INDEX CONCURRENTLY` in our new migration causes flyway to
automatically run the migration in `autocommit` mode.
`connection.commit()` is only supposed to be called when autocommit mode
is off.

This change makes our migration test runner able to handle migrations
that run in `autocommit` mode.

[#169775896]

Signed-off-by: Andrew Edstrom <aedstrom@pivotal.io>
Co-authored-by: Andrew Edstrom <aedstrom@pivotal.io>
Signed-off-by: Andrew Edstrom <aedstrom@pivotal.io>
  • Loading branch information
joshuatcasey and andrewedstrom committed Dec 13, 2019
1 parent 0bed300 commit 480760e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public void run(MigrationTest... tests) {
public void afterEachMigrate(Connection connection, MigrationInfo info) {
super.afterEachMigrate(connection, info);
try {
connection.commit();
if (!connection.getAutoCommit()) {
connection.commit();
}
} catch (SQLException e) {
Assert.fail(e.getMessage());
}
Expand Down

0 comments on commit 480760e

Please sign in to comment.