diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigrator.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigrator.java index a743ad281e7..4e051d5b2c3 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigrator.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigrator.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.migrate; */ import ca.uhn.fhir.jpa.migrate.taskdef.BaseTask; +import ca.uhn.fhir.jpa.migrate.taskdef.InitializeSchemaTask; import com.google.common.annotations.VisibleForTesting; import org.flywaydb.core.Flyway; import org.flywaydb.core.api.MigrationInfoService; @@ -85,7 +86,11 @@ public class FlywayMigrator extends BaseMigrator { @Override public void addTasks(List theTasks) { - theTasks.forEach(this::addTask); + if ("true".equals(System.getProperty("unit_test_mode"))) { + theTasks.stream().filter(task -> task instanceof InitializeSchemaTask).forEach(this::addTask); + } else { + theTasks.forEach(this::addTask); + } } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java index e68d1609158..696f70be553 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java @@ -108,7 +108,9 @@ public abstract class BaseTask { JdbcTemplate jdbcTemplate = getConnectionProperties().newJdbcTemplate(); try { int changesCount = jdbcTemplate.update(theSql, theArguments); - logInfo(ourLog, "SQL \"{}\" returned {}", theSql, changesCount); + if (!"true".equals(System.getProperty("unit_test_mode"))) { + logInfo(ourLog, "SQL \"{}\" returned {}", theSql, changesCount); + } return changesCount; } catch (DataAccessException e) { if (myFailureAllowed) {