Skip to content

Commit

Permalink
fjerner flyway clean on validation error for tester ettersom det ikke…
Browse files Browse the repository at this point in the history
… er støttet mot oracle (#1164)
  • Loading branch information
palfi committed Apr 18, 2024
1 parent 23ded0f commit 8fb9437
Showing 1 changed file with 6 additions and 8 deletions.
Expand Up @@ -2,6 +2,7 @@

import static java.lang.Runtime.getRuntime;

import java.sql.SQLException;
import java.util.concurrent.atomic.AtomicBoolean;

import javax.naming.NamingException;
Expand Down Expand Up @@ -48,21 +49,18 @@ public static void migrerUnittestSkjemaer() {
.locations(DB_SCRIPT_LOCATION + SCHEMA)
.table("schema_version")
.baselineOnMigrate(true)
.cleanDisabled(false)
.load();
try {
if (!ENV.isLocal()) {
throw new IllegalStateException("Forventer at denne migreringen bare kjøres lokalt");
}
flyway.migrate();
} catch (FlywayException fwe) {
try {
// prøver igjen
flyway.clean();
flyway.migrate();
} catch (FlywayException fwe2) {
throw new IllegalStateException("Migrering feiler", fwe2);
var connection = flyway.getConfiguration().getDataSource().getConnection();
if (!connection.isClosed()) {
connection.close();
}
} catch (SQLException sqlex) {
// nothing to do here
}
}
}
Expand Down

0 comments on commit 8fb9437

Please sign in to comment.