This commit is contained in:
Ken Stevens 2019-11-26 11:36:25 -05:00
parent 82990f3e97
commit 3b35724bdd
2 changed files with 11 additions and 2 deletions

View File

@ -22,7 +22,6 @@ package ca.uhn.fhir.cli;
import ca.uhn.fhir.jpa.migrate.DriverTypeEnum; import ca.uhn.fhir.jpa.migrate.DriverTypeEnum;
import ca.uhn.fhir.jpa.migrate.FlywayMigrator; 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.CommandLine;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
@ -41,6 +40,11 @@ public abstract class BaseFlywayMigrateDatabaseCommand<T extends Enum> extends B
public static final String MIGRATE_DATABASE = "migrate-database"; public static final String MIGRATE_DATABASE = "migrate-database";
private Set<String> myFlags; private Set<String> myFlags;
private final String myMigrationTablename;
protected BaseFlywayMigrateDatabaseCommand(String theMigrationTablename) {
myMigrationTablename = theMigrationTablename;
}
protected Set<String> getFlags() { protected Set<String> getFlags() {
return myFlags; return myFlags;
@ -110,7 +114,7 @@ public abstract class BaseFlywayMigrateDatabaseCommand<T extends Enum> extends B
.filter(StringUtils::isNotBlank) .filter(StringUtils::isNotBlank)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
FlywayMigrator migrator = new FlywayMigrator(SchemaMigrator.HAPI_FHIR_MIGRATION_TABLENAME); FlywayMigrator migrator = new FlywayMigrator(myMigrationTablename);
migrator.setConnectionUrl(url); migrator.setConnectionUrl(url);
migrator.setDriverType(driverType); migrator.setDriverType(driverType);
migrator.setUsername(username); migrator.setUsername(username);

View File

@ -21,6 +21,7 @@ package ca.uhn.fhir.cli;
*/ */
import ca.uhn.fhir.jpa.migrate.FlywayMigrator; 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.taskdef.BaseTask;
import ca.uhn.fhir.jpa.migrate.tasks.HapiFhirJpaMigrationTasks; import ca.uhn.fhir.jpa.migrate.tasks.HapiFhirJpaMigrationTasks;
import ca.uhn.fhir.util.VersionEnum; import ca.uhn.fhir.util.VersionEnum;
@ -30,6 +31,10 @@ import java.util.List;
public class HapiFlywayMigrateDatabaseCommand extends BaseFlywayMigrateDatabaseCommand<VersionEnum> { public class HapiFlywayMigrateDatabaseCommand extends BaseFlywayMigrateDatabaseCommand<VersionEnum> {
public HapiFlywayMigrateDatabaseCommand() {
super(SchemaMigrator.HAPI_FHIR_MIGRATION_TABLENAME);
}
@Override @Override
protected List<VersionEnum> provideAllowedVersions() { protected List<VersionEnum> provideAllowedVersions() {
return Arrays.asList(VersionEnum.values()); return Arrays.asList(VersionEnum.values());