configurable table name
This commit is contained in:
parent
01ebe9ae8c
commit
8c7c4fc56f
|
@ -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,7 @@ public abstract class BaseFlywayMigrateDatabaseCommand<T extends Enum> extends B
|
|||
|
||||
public static final String MIGRATE_DATABASE = "migrate-database";
|
||||
private Set<String> myFlags;
|
||||
private String myMigrationTableName;
|
||||
|
||||
protected Set<String> getFlags() {
|
||||
return myFlags;
|
||||
|
@ -110,7 +110,7 @@ public abstract class BaseFlywayMigrateDatabaseCommand<T extends Enum> 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);
|
||||
|
@ -123,4 +123,7 @@ public abstract class BaseFlywayMigrateDatabaseCommand<T extends Enum> extends B
|
|||
|
||||
protected abstract void addTasks(FlywayMigrator theMigrator);
|
||||
|
||||
public void setMigrationTableName(String theMigrationTableName) {
|
||||
myMigrationTableName = theMigrationTableName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,12 @@ 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;
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -45,4 +48,10 @@ public class HapiFlywayMigrateDatabaseCommand extends BaseFlywayMigrateDatabaseC
|
|||
List<BaseTask<?>> tasks = new HapiFhirJpaMigrationTasks(getFlags()).getAllTasks(VersionEnum.values());
|
||||
theMigrator.addTasks(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(CommandLine theCommandLine) throws ParseException {
|
||||
setMigrationTableName(SchemaMigrator.HAPI_FHIR_MIGRATION_TABLENAME);
|
||||
super.run(theCommandLine);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue