not sure this is going to work yet
This commit is contained in:
parent
da54d3443e
commit
5f30bdb27b
|
@ -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.BaseTask;
|
||||||
|
import ca.uhn.fhir.jpa.migrate.taskdef.InitializeSchemaTask;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import org.flywaydb.core.Flyway;
|
import org.flywaydb.core.Flyway;
|
||||||
import org.flywaydb.core.api.MigrationInfoService;
|
import org.flywaydb.core.api.MigrationInfoService;
|
||||||
|
@ -85,7 +86,11 @@ public class FlywayMigrator extends BaseMigrator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTasks(List<BaseTask> theTasks) {
|
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
|
@Override
|
||||||
|
|
|
@ -108,7 +108,9 @@ public abstract class BaseTask<T extends BaseTask> {
|
||||||
JdbcTemplate jdbcTemplate = getConnectionProperties().newJdbcTemplate();
|
JdbcTemplate jdbcTemplate = getConnectionProperties().newJdbcTemplate();
|
||||||
try {
|
try {
|
||||||
int changesCount = jdbcTemplate.update(theSql, theArguments);
|
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;
|
return changesCount;
|
||||||
} catch (DataAccessException e) {
|
} catch (DataAccessException e) {
|
||||||
if (myFailureAllowed) {
|
if (myFailureAllowed) {
|
||||||
|
|
Loading…
Reference in New Issue