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
  • Loading branch information
palfi committed Apr 18, 2024
1 parent 8b64a35 commit 02c67bd
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.Objects;
import java.util.concurrent.atomic.AtomicBoolean;

Expand All @@ -10,7 +11,6 @@

import org.eclipse.jetty.plus.jndi.EnvEntry;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.FlywayException;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
Expand Down Expand Up @@ -56,14 +56,12 @@ public static void migrerUnittestSkjemaer() {
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 02c67bd

Please sign in to comment.