From 3b35724bdd72d91d278b4fbfcf86312808e71740 Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Tue, 26 Nov 2019 11:36:25 -0500 Subject: [PATCH] fix test --- .../ca/uhn/fhir/cli/BaseFlywayMigrateDatabaseCommand.java | 8 ++++++-- .../ca/uhn/fhir/cli/HapiFlywayMigrateDatabaseCommand.java | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/BaseFlywayMigrateDatabaseCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/BaseFlywayMigrateDatabaseCommand.java index 95d82fa305a..0c5207ab246 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/BaseFlywayMigrateDatabaseCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/BaseFlywayMigrateDatabaseCommand.java @@ -22,7 +22,6 @@ package ca.uhn.fhir.cli; import ca.uhn.fhir.jpa.migrate.DriverTypeEnum; import ca.uhn.fhir.jpa.migrate.FlywayMigrator; -import ca.uhn.fhir.jpa.migrate.SchemaMigrator; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; @@ -41,6 +40,11 @@ public abstract class BaseFlywayMigrateDatabaseCommand extends B public static final String MIGRATE_DATABASE = "migrate-database"; private Set myFlags; + private final String myMigrationTablename; + + protected BaseFlywayMigrateDatabaseCommand(String theMigrationTablename) { + myMigrationTablename = theMigrationTablename; + } protected Set getFlags() { return myFlags; @@ -110,7 +114,7 @@ public abstract class BaseFlywayMigrateDatabaseCommand extends B .filter(StringUtils::isNotBlank) .collect(Collectors.toSet()); - FlywayMigrator migrator = new FlywayMigrator(SchemaMigrator.HAPI_FHIR_MIGRATION_TABLENAME); + FlywayMigrator migrator = new FlywayMigrator(myMigrationTablename); migrator.setConnectionUrl(url); migrator.setDriverType(driverType); migrator.setUsername(username); diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/HapiFlywayMigrateDatabaseCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/HapiFlywayMigrateDatabaseCommand.java index 9de06be32eb..15485fceed5 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/HapiFlywayMigrateDatabaseCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/HapiFlywayMigrateDatabaseCommand.java @@ -21,6 +21,7 @@ package ca.uhn.fhir.cli; */ import ca.uhn.fhir.jpa.migrate.FlywayMigrator; +import ca.uhn.fhir.jpa.migrate.SchemaMigrator; import ca.uhn.fhir.jpa.migrate.taskdef.BaseTask; import ca.uhn.fhir.jpa.migrate.tasks.HapiFhirJpaMigrationTasks; import ca.uhn.fhir.util.VersionEnum; @@ -30,6 +31,10 @@ import java.util.List; public class HapiFlywayMigrateDatabaseCommand extends BaseFlywayMigrateDatabaseCommand { + public HapiFlywayMigrateDatabaseCommand() { + super(SchemaMigrator.HAPI_FHIR_MIGRATION_TABLENAME); + } + @Override protected List provideAllowedVersions() { return Arrays.asList(VersionEnum.values());