not sure this is going to work yet

This commit is contained in:
Ken Stevens 2020-02-04 17:00:56 -05:00
parent da54d3443e
commit 5f30bdb27b
2 changed files with 9 additions and 2 deletions

View File

@ -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<BaseTask> 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

View File

@ -108,7 +108,9 @@ public abstract class BaseTask<T extends 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) {