From a123bfe564931ab99481ec39ba36da14ce992997 Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Mon, 28 Oct 2019 17:28:26 -0400 Subject: [PATCH] All tests pass except createTableByColumns --- .../uhn/fhir/jpa/migrate/FlywayMigration.java | 3 +- .../jpa/migrate/taskdef/ArbitrarySqlTask.java | 5 +- .../fhir/jpa/migrate/taskdef/BaseTask.java | 7 +- .../migrate/taskdef/CalculateHashesTask.java | 5 +- .../tasks/HapiFhirJpaMigrationTasks.java | 319 +++++++++--------- .../migrate/tasks/api/BaseMigrationTasks.java | 7 +- .../jpa/migrate/taskdef/AddColumnTest.java | 6 +- .../taskdef/AddForeignKeyTaskTest.java | 2 +- .../taskdef/AddIdGeneratorTaskTest.java | 2 +- .../jpa/migrate/taskdef/AddIndexTest.java | 8 +- .../taskdef/AddTableByColumnTaskTest.java | 8 +- .../jpa/migrate/taskdef/AddTableTest.java | 4 +- .../migrate/taskdef/ArbitrarySqlTaskTest.java | 10 +- .../migrate/taskdef/CalculateHashesTest.java | 5 +- .../jpa/migrate/taskdef/DropColumnTest.java | 2 +- .../taskdef/DropForeignKeyTaskTest.java | 2 +- .../taskdef/DropIdGeneratorTaskTest.java | 2 +- .../jpa/migrate/taskdef/DropIndexTest.java | 8 +- .../jpa/migrate/taskdef/DropTableTest.java | 6 +- .../jpa/migrate/taskdef/ModifyColumnTest.java | 20 +- .../migrate/taskdef/RenameColumnTaskTest.java | 14 +- 21 files changed, 228 insertions(+), 217 deletions(-) diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java index e29544903028..249989f810eb 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java @@ -22,7 +22,8 @@ public FlywayMigration(BaseTask theTask, FlywayMigrator theFlywayMigrator) { @Override public MigrationVersion getVersion() { - return MigrationVersion.fromVersion(myTask.getFlywayVersion()); + String flywayVersion = myTask.getFlywayVersion(); + return MigrationVersion.fromVersion(flywayVersion); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java index 4ac1c263b2dd..a71453b98ba0 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java @@ -21,6 +21,7 @@ */ import ca.uhn.fhir.jpa.migrate.JdbcUtils; +import ca.uhn.fhir.util.VersionEnum; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,8 +45,8 @@ public class ArbitrarySqlTask extends BaseTask { private String myExecuteOnlyIfTableExists; private List myConditionalOnExistenceOf = new ArrayList<>(); - public ArbitrarySqlTask(String theRelease, String theVersion, String theTableName, String theDescription) { - super(theRelease, theVersion); + public ArbitrarySqlTask(VersionEnum theRelease, String theVersion, String theTableName, String theDescription) { + super(theRelease.toString(), theVersion); myTableName = theTableName; myDescription = theDescription; } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java index 8fcb42256cb2..109165fed2dd 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java @@ -138,7 +138,12 @@ public JdbcTemplate newJdbcTemnplate() { public abstract void execute() throws SQLException; public String getFlywayVersion() { - return myRelease + "." + myVersion; + String retval = ""; + String releasePart = myRelease; + if (releasePart.startsWith("V")) { + releasePart = releasePart.substring(1); + } + return releasePart + "." + myVersion; } public static class ExecutedStatement { diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java index 91c57efe7aa0..524b651f0d0e 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java @@ -21,6 +21,7 @@ */ import ca.uhn.fhir.util.StopWatch; +import ca.uhn.fhir.util.VersionEnum; import com.google.common.collect.ForwardingMap; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.concurrent.BasicThreadFactory; @@ -53,8 +54,8 @@ public void setBatchSize(int theBatchSize) { /** * Constructor */ - public CalculateHashesTask(String theRelease, String theVersion) { - super(theRelease, theVersion); + public CalculateHashesTask(VersionEnum theRelease, String theVersion) { + super(theRelease.toString(), theVersion); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java index 8c5b13a4e26c..dce2073f857d 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java @@ -61,12 +61,12 @@ protected void init410() { Builder version = forVersion(VersionEnum.V4_1_0); // HFJ_SEARCH - version.onTable("HFJ_SEARCH").addColumn("EXPIRY_OR_NULL").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.DATE_TIMESTAMP); - version.onTable("HFJ_SEARCH").addColumn("NUM_BLOCKED").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.INT); + version.onTable("HFJ_SEARCH").addColumn("20190921.1", "EXPIRY_OR_NULL").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.DATE_TIMESTAMP); + version.onTable("HFJ_SEARCH").addColumn("20190921.2", "NUM_BLOCKED").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.INT); // HFJ_BLK_EXPORT_JOB - version.addIdGenerator("SEQ_BLKEXJOB_PID"); - Builder.BuilderAddTableByColumns bulkExportJob = version.addTableByColumns("HFJ_BLK_EXPORT_JOB", "PID"); + version.addIdGenerator("20190921.3", "SEQ_BLKEXJOB_PID"); + Builder.BuilderAddTableByColumns bulkExportJob = version.addTableByColumns("20190921.4", "HFJ_BLK_EXPORT_JOB", "PID"); bulkExportJob.addColumn("PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); bulkExportJob.addColumn("JOB_ID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 36); bulkExportJob.addColumn("JOB_STATUS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 10); @@ -81,36 +81,36 @@ protected void init410() { bulkExportJob.addIndex("IDX_BLKEX_JOB_ID").unique(true).withColumns("JOB_ID"); // HFJ_BLK_EXPORT_COLLECTION - version.addIdGenerator("SEQ_BLKEXCOL_PID"); - Builder.BuilderAddTableByColumns bulkExportCollection = version.addTableByColumns("HFJ_BLK_EXPORT_COLLECTION", "PID"); + version.addIdGenerator("20190921.5", "SEQ_BLKEXCOL_PID"); + Builder.BuilderAddTableByColumns bulkExportCollection = version.addTableByColumns("20190921.6", "HFJ_BLK_EXPORT_COLLECTION", "PID"); bulkExportCollection.addColumn("PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); bulkExportCollection.addColumn("JOB_PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); - bulkExportCollection.addForeignKey("FK_BLKEXCOL_JOB").toColumn("JOB_PID").references("HFJ_BLK_EXPORT_JOB", "PID"); + bulkExportCollection.addForeignKey("FK_BLKEXCOL_JOB").toColumn("JOB_PID").references("20190921.7", "HFJ_BLK_EXPORT_JOB", "PID"); bulkExportCollection.addColumn("RES_TYPE").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); bulkExportCollection.addColumn("TYPE_FILTER").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 1000); bulkExportCollection.addColumn("OPTLOCK").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.INT); // HFJ_BLK_EXPORT_COLFILE - version.addIdGenerator("SEQ_BLKEXCOLFILE_PID"); - Builder.BuilderAddTableByColumns bulkExportCollectionFile = version.addTableByColumns("HFJ_BLK_EXPORT_COLFILE", "PID"); + version.addIdGenerator("20190921.8", "SEQ_BLKEXCOLFILE_PID"); + Builder.BuilderAddTableByColumns bulkExportCollectionFile = version.addTableByColumns("20190921.9", "HFJ_BLK_EXPORT_COLFILE", "PID"); bulkExportCollectionFile.addColumn("PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); bulkExportCollectionFile.addColumn("COLLECTION_PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); bulkExportCollectionFile.addColumn("RES_ID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); - bulkExportCollectionFile.addForeignKey("FK_BLKEXCOLFILE_COLLECT").toColumn("COLLECTION_PID").references("HFJ_BLK_EXPORT_COLLECTION", "PID"); + bulkExportCollectionFile.addForeignKey("FK_BLKEXCOLFILE_COLLECT").toColumn("COLLECTION_PID").references("20190921.10", "HFJ_BLK_EXPORT_COLLECTION", "PID"); // HFJ_RES_VER_PROV version.startSectionWithMessage("Processing bulkExportCollectionFile: HFJ_RES_VER_PROV"); - Builder.BuilderAddTableByColumns resVerProv = version.addTableByColumns("HFJ_RES_VER_PROV", "RES_VER_PID"); + Builder.BuilderAddTableByColumns resVerProv = version.addTableByColumns("20190921.11", "HFJ_RES_VER_PROV", "RES_VER_PID"); resVerProv.addColumn("RES_VER_PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); resVerProv .addForeignKey("FK_RESVERPROV_RESVER_PID") .toColumn("RES_VER_PID") - .references("HFJ_RES_VER", "PID"); + .references("20190921.12", "HFJ_RES_VER", "PID"); resVerProv.addColumn("RES_PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); resVerProv .addForeignKey("FK_RESVERPROV_RES_PID") .toColumn("RES_PID") - .references("HFJ_RESOURCE", "RES_ID"); + .references("20190921.13", "HFJ_RESOURCE", "RES_ID"); resVerProv.addColumn("SOURCE_URI").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); resVerProv.addColumn("REQUEST_ID").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 16); resVerProv.addIndex("IDX_RESVERPROV_SOURCEURI").unique(false).withColumns("SOURCE_URI"); @@ -119,61 +119,62 @@ protected void init410() { // TermValueSetConceptDesignation version.startSectionWithMessage("Processing bulkExportCollectionFile: TRM_VALUESET_C_DESIGNATION"); Builder.BuilderWithTableName termValueSetConceptDesignationTable = version.onTable("TRM_VALUESET_C_DESIGNATION"); - termValueSetConceptDesignationTable.addColumn("VALUESET_PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); + // FIXME KHS validate the version numbers are in order + termValueSetConceptDesignationTable.addColumn("20190921.14", "VALUESET_PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); termValueSetConceptDesignationTable .addForeignKey("FK_TRM_VSCD_VS_PID") .toColumn("VALUESET_PID") - .references("TRM_VALUESET", "PID"); + .references("20190921.15", "TRM_VALUESET", "PID"); // Drop HFJ_SEARCH_RESULT foreign keys - version.onTable("HFJ_SEARCH_RESULT").dropForeignKey("FK_SEARCHRES_RES", "HFJ_RESOURCE"); - version.onTable("HFJ_SEARCH_RESULT").dropForeignKey("FK_SEARCHRES_SEARCH", "HFJ_SEARCH"); + version.onTable("HFJ_SEARCH_RESULT").dropForeignKey("20190921.16", "FK_SEARCHRES_RES", "HFJ_RESOURCE"); + version.onTable("HFJ_SEARCH_RESULT").dropForeignKey("20190921.17", "FK_SEARCHRES_SEARCH", "HFJ_SEARCH"); // TermValueSet version.startSectionWithMessage("Processing bulkExportCollectionFile: TRM_VALUESET"); Builder.BuilderWithTableName termValueSetTable = version.onTable("TRM_VALUESET"); - termValueSetTable.addColumn("TOTAL_CONCEPTS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); - termValueSetTable.addColumn("TOTAL_CONCEPT_DESIGNATIONS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); + termValueSetTable.addColumn("20190921.18", "TOTAL_CONCEPTS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); + termValueSetTable.addColumn("20190921.19", "TOTAL_CONCEPT_DESIGNATIONS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); termValueSetTable - .dropIndex("IDX_VALUESET_EXP_STATUS"); + .dropIndex("20190921.20", "IDX_VALUESET_EXP_STATUS"); - version.dropIdGenerator("SEQ_SEARCHPARM_ID"); + version.dropIdGenerator("20190921.21", "SEQ_SEARCHPARM_ID"); // TermValueSetConcept version.startSectionWithMessage("Processing bulkExportCollectionFile: TRM_VALUESET_CONCEPT"); Builder.BuilderWithTableName termValueSetConceptTable = version.onTable("TRM_VALUESET_CONCEPT"); - termValueSetConceptTable.addColumn("VALUESET_ORDER").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.INT); + termValueSetConceptTable.addColumn("20190921.22", "VALUESET_ORDER").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.INT); termValueSetConceptTable .addIndex("IDX_VS_CONCEPT_ORDER") .unique(true) .withColumns("VALUESET_PID", "VALUESET_ORDER"); // Account for RESTYPE_LEN column increasing from 30 to 40 - version.onTable("HFJ_RESOURCE").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); - version.onTable("HFJ_RES_VER").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); - version.onTable("HFJ_HISTORY_TAG").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); - version.onTable("HFJ_RES_LINK").modifyColumn("SOURCE_RESOURCE_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); - version.onTable("HFJ_RES_LINK").modifyColumn("TARGET_RESOURCE_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); - version.onTable("HFJ_RES_TAG").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); + version.onTable("HFJ_RESOURCE").modifyColumn("RES_TYPE").nonNullable().withType("20191002.1", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); + version.onTable("HFJ_RES_VER").modifyColumn("RES_TYPE").nonNullable().withType("20191002.2", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); + version.onTable("HFJ_HISTORY_TAG").modifyColumn("RES_TYPE").nonNullable().withType("20191002.3", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); + version.onTable("HFJ_RES_LINK").modifyColumn("SOURCE_RESOURCE_TYPE").nonNullable().withType("20191002.4", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); + version.onTable("HFJ_RES_LINK").modifyColumn("TARGET_RESOURCE_TYPE").nonNullable().withType("20191002.5", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); + version.onTable("HFJ_RES_TAG").modifyColumn("RES_TYPE").nonNullable().withType("20191002.6", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 40); // TermConceptDesignation version.startSectionWithMessage("Processing table: TRM_CONCEPT_DESIG"); - version.onTable("TRM_CONCEPT_DESIG").modifyColumn("VAL").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 2000); + version.onTable("TRM_CONCEPT_DESIG").modifyColumn("VAL").nonNullable().withType("20191002.7", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 2000); // TermValueSetConceptDesignation version.startSectionWithMessage("Processing table: TRM_VALUESET_C_DESIGNATION"); - version.onTable("TRM_VALUESET_C_DESIGNATION").modifyColumn("VAL").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 2000); + version.onTable("TRM_VALUESET_C_DESIGNATION").modifyColumn("VAL").nonNullable().withType("20191002.8", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 2000); // TermConceptProperty version.startSectionWithMessage("Processing table: TRM_CONCEPT_PROPERTY"); - version.onTable("TRM_CONCEPT_PROPERTY").addColumn("PROP_VAL_LOB").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.BLOB); + version.onTable("TRM_CONCEPT_PROPERTY").addColumn("20191002.9", "PROP_VAL_LOB").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.BLOB); } protected void init400() { Builder version = forVersion(VersionEnum.V4_0_0); // BinaryStorageEntity - Builder.BuilderAddTableByColumns binaryBlob = version.addTableByColumns("HFJ_BINARY_STORAGE_BLOB", "BLOB_ID"); + Builder.BuilderAddTableByColumns binaryBlob = version.addTableByColumns("20190722.1", "HFJ_BINARY_STORAGE_BLOB", "BLOB_ID"); binaryBlob.addColumn("BLOB_ID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); binaryBlob.addColumn("RESOURCE_ID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); binaryBlob.addColumn("BLOB_SIZE").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.INT); @@ -183,64 +184,64 @@ protected void init400() { binaryBlob.addColumn("BLOB_HASH").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 128); // Interim builds used this name - version.onTable("TRM_VALUESET_CODE").dropThisTable(); + version.onTable("TRM_VALUESET_CODE").dropThisTable("20190722.2"); version.onTable("TRM_CONCEPT_MAP_GROUP") - .renameColumn("myConceptMapUrl", "CONCEPT_MAP_URL", false, true) - .renameColumn("mySourceValueSet", "SOURCE_VS", false, true) - .renameColumn("myTargetValueSet", "TARGET_VS", false, true); + .renameColumn("20190722.3", "myConceptMapUrl", "CONCEPT_MAP_URL", false, true) + .renameColumn("20190722.4", "mySourceValueSet", "SOURCE_VS", false, true) + .renameColumn("20190722.5", "myTargetValueSet", "TARGET_VS", false, true); version.onTable("TRM_CONCEPT_MAP_GROUP") - .modifyColumn("CONCEPT_MAP_URL").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("CONCEPT_MAP_URL").nullable().withType("20190722.6", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GROUP") - .modifyColumn("SOURCE_VERSION").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("SOURCE_VERSION").nullable().withType("20190722.7", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GROUP") - .modifyColumn("SOURCE_VS").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("SOURCE_VS").nullable().withType("20190722.8", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GROUP") - .modifyColumn("TARGET_VERSION").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("TARGET_VERSION").nullable().withType("20190722.9", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GROUP") - .modifyColumn("TARGET_VS").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("TARGET_VS").nullable().withType("20190722.10", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GRP_ELEMENT") - .renameColumn("myConceptMapUrl", "CONCEPT_MAP_URL", false, true) - .renameColumn("mySystem", "SYSTEM_URL", false, true) - .renameColumn("mySystemVersion", "SYSTEM_VERSION", false, true) - .renameColumn("myValueSet", "VALUESET_URL", false, true); + .renameColumn("20190722.11", "myConceptMapUrl", "CONCEPT_MAP_URL", false, true) + .renameColumn("20190722.12", "mySystem", "SYSTEM_URL", false, true) + .renameColumn("20190722.13", "mySystemVersion", "SYSTEM_VERSION", false, true) + .renameColumn("20190722.14", "myValueSet", "VALUESET_URL", false, true); version.onTable("TRM_CONCEPT_MAP_GRP_ELEMENT") - .modifyColumn("CONCEPT_MAP_URL").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("CONCEPT_MAP_URL").nullable().withType("20190722.15", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GRP_ELEMENT") - .modifyColumn("SOURCE_CODE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); + .modifyColumn("SOURCE_CODE").nonNullable().withType("20190722.16", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); version.onTable("TRM_CONCEPT_MAP_GRP_ELEMENT") - .modifyColumn("SYSTEM_URL").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("SYSTEM_URL").nullable().withType("20190722.17", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GRP_ELEMENT") - .modifyColumn("SYSTEM_VERSION").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("SYSTEM_VERSION").nullable().withType("20190722.18", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GRP_ELEMENT") - .modifyColumn("VALUESET_URL").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("VALUESET_URL").nullable().withType("20190722.19", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GRP_ELM_TGT") - .renameColumn("myConceptMapUrl", "CONCEPT_MAP_URL", false, true) - .renameColumn("mySystem", "SYSTEM_URL", false, true) - .renameColumn("mySystemVersion", "SYSTEM_VERSION", false, true) - .renameColumn("myValueSet", "VALUESET_URL", false, true); + .renameColumn("20190722.20", "myConceptMapUrl", "CONCEPT_MAP_URL", false, true) + .renameColumn("20190722.21", "mySystem", "SYSTEM_URL", false, true) + .renameColumn("20190722.22", "mySystemVersion", "SYSTEM_VERSION", false, true) + .renameColumn("20190722.23", "myValueSet", "VALUESET_URL", false, true); version.onTable("TRM_CONCEPT_MAP_GRP_ELM_TGT") - .modifyColumn("CONCEPT_MAP_URL").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("CONCEPT_MAP_URL").nullable().withType("20190722.24", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GRP_ELM_TGT") - .modifyColumn("SYSTEM_URL").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("SYSTEM_URL").nullable().withType("20190722.25", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GRP_ELM_TGT") - .modifyColumn("SYSTEM_VERSION").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("SYSTEM_VERSION").nullable().withType("20190722.26", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT_MAP_GRP_ELM_TGT") - .modifyColumn("TARGET_CODE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); + .modifyColumn("TARGET_CODE").nonNullable().withType("20190722.27", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); version.onTable("TRM_CONCEPT_MAP_GRP_ELM_TGT") - .modifyColumn("VALUESET_URL").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .modifyColumn("VALUESET_URL").nullable().withType("20190722.28", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_CONCEPT") - .renameColumn("CODE", "CODEVAL", false, true); + .renameColumn("20190722.29", "CODE", "CODEVAL", false, true); // TermValueSet version.startSectionWithMessage("Processing table: TRM_VALUESET"); - version.addIdGenerator("SEQ_VALUESET_PID"); - Builder.BuilderAddTableByColumns termValueSetTable = version.addTableByColumns("TRM_VALUESET", "PID"); + version.addIdGenerator("20190722.30", "SEQ_VALUESET_PID"); + Builder.BuilderAddTableByColumns termValueSetTable = version.addTableByColumns("20190722.31", "TRM_VALUESET", "PID"); termValueSetTable.addColumn("PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); termValueSetTable.addColumn("URL").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); termValueSetTable @@ -251,16 +252,16 @@ protected void init400() { termValueSetTable .addForeignKey("FK_TRMVALUESET_RES") .toColumn("RES_ID") - .references("HFJ_RESOURCE", "RES_ID"); + .references("20190722.32", "HFJ_RESOURCE", "RES_ID"); termValueSetTable.addColumn("NAME").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); version.onTable("TRM_VALUESET") - .renameColumn("NAME", "VSNAME", true, true); + .renameColumn("20190722.33", "NAME", "VSNAME", true, true); version.onTable("TRM_VALUESET") - .modifyColumn("RES_ID").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); + .modifyColumn("RES_ID").nullable().withType("20190722.34", BaseTableColumnTypeTask.ColumnTypeEnum.LONG); Builder.BuilderWithTableName termValueSetTableChange = version.onTable("TRM_VALUESET"); - termValueSetTableChange.addColumn("EXPANSION_STATUS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 50); + termValueSetTableChange.addColumn("20190722.35", "EXPANSION_STATUS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 50); termValueSetTableChange .addIndex("IDX_VALUESET_EXP_STATUS") .unique(false) @@ -268,23 +269,23 @@ protected void init400() { // TermValueSetConcept version.startSectionWithMessage("Processing table: TRM_VALUESET_CONCEPT"); - version.addIdGenerator("SEQ_VALUESET_CONCEPT_PID"); - Builder.BuilderAddTableByColumns termValueSetConceptTable = version.addTableByColumns("TRM_VALUESET_CONCEPT", "PID"); + version.addIdGenerator("20190722.36", "SEQ_VALUESET_CONCEPT_PID"); + Builder.BuilderAddTableByColumns termValueSetConceptTable = version.addTableByColumns("20190722.37", "TRM_VALUESET_CONCEPT", "PID"); termValueSetConceptTable.addColumn("PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); termValueSetConceptTable.addColumn("VALUESET_PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); termValueSetConceptTable .addForeignKey("FK_TRM_VALUESET_PID") .toColumn("VALUESET_PID") - .references("TRM_VALUESET", "PID"); + .references("20190722.38", "TRM_VALUESET", "PID"); termValueSetConceptTable.addColumn("SYSTEM_URL").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); termValueSetConceptTable.addColumn("CODEVAL").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); termValueSetConceptTable.addColumn("DISPLAY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 400); version.onTable("TRM_VALUESET_CONCEPT") - .renameColumn("CODE", "CODEVAL", true, true) - .renameColumn("SYSTEM", "SYSTEM_URL", true, true); + .renameColumn("20190722.39", "CODE", "CODEVAL", true, true) + .renameColumn("20190722.40", "SYSTEM", "SYSTEM_URL", true, true); version.startSectionWithMessage("Processing table: TRM_VALUESET_CONCEPT, swapping index for unique constraint"); - termValueSetConceptTable.dropIndex("IDX_VALUESET_CONCEPT_CS_CD"); + termValueSetConceptTable.dropIndex("20190801.1", "IDX_VALUESET_CONCEPT_CS_CD"); termValueSetConceptTable .addIndex("IDX_VS_CONCEPT_CS_CD") .unique(true) @@ -292,14 +293,14 @@ protected void init400() { // TermValueSetConceptDesignation version.startSectionWithMessage("Processing table: TRM_VALUESET_C_DESIGNATION"); - version.addIdGenerator("SEQ_VALUESET_C_DSGNTN_PID"); - Builder.BuilderAddTableByColumns termValueSetConceptDesignationTable = version.addTableByColumns("TRM_VALUESET_C_DESIGNATION", "PID"); + version.addIdGenerator("20190801.2", "SEQ_VALUESET_C_DSGNTN_PID"); + Builder.BuilderAddTableByColumns termValueSetConceptDesignationTable = version.addTableByColumns("20190801.3", "TRM_VALUESET_C_DESIGNATION", "PID"); termValueSetConceptDesignationTable.addColumn("PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); termValueSetConceptDesignationTable.addColumn("VALUESET_CONCEPT_PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); termValueSetConceptDesignationTable .addForeignKey("FK_TRM_VALUESET_CONCEPT_PID") .toColumn("VALUESET_CONCEPT_PID") - .references("TRM_VALUESET_CONCEPT", "PID"); + .references("20190801.4", "TRM_VALUESET_CONCEPT", "PID"); termValueSetConceptDesignationTable.addColumn("LANG").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); termValueSetConceptDesignationTable.addColumn("USE_SYSTEM").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); termValueSetConceptDesignationTable.addColumn("USE_CODE").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); @@ -313,11 +314,11 @@ protected void init400() { // TermCodeSystemVersion version.startSectionWithMessage("Processing table: TRM_CODESYSTEM_VER"); Builder.BuilderWithTableName termCodeSystemVersionTable = version.onTable("TRM_CODESYSTEM_VER"); - termCodeSystemVersionTable.addColumn("CS_DISPLAY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + termCodeSystemVersionTable.addColumn("20190905.1", "CS_DISPLAY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); // ResourceReindexJobEntry - version.addIdGenerator("SEQ_RES_REINDEX_JOB"); - Builder.BuilderAddTableByColumns reindex = version.addTableByColumns("HFJ_RES_REINDEX_JOB", "PID"); + version.addIdGenerator("20190905.2", "SEQ_RES_REINDEX_JOB"); + Builder.BuilderAddTableByColumns reindex = version.addTableByColumns("20190905.3", "HFJ_RES_REINDEX_JOB", "PID"); reindex.addColumn("PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); reindex.addColumn("RES_TYPE").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); reindex.addColumn("UPDATE_THRESHOLD_HIGH").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.DATE_TIMESTAMP); @@ -328,33 +329,33 @@ protected void init400() { // Search version.onTable("HFJ_SEARCH") - .addColumn("SEARCH_DELETED").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.BOOLEAN); + .addColumn("20190905.4", "SEARCH_DELETED").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.BOOLEAN); version.onTable("HFJ_SEARCH") - .modifyColumn("SEARCH_LAST_RETURNED").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.DATE_TIMESTAMP); + .modifyColumn("SEARCH_LAST_RETURNED").nonNullable().withType("20190905.5", BaseTableColumnTypeTask.ColumnTypeEnum.DATE_TIMESTAMP); version.onTable("HFJ_SEARCH") - .addColumn("SEARCH_PARAM_MAP").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.BLOB); + .addColumn("20190905.6", "SEARCH_PARAM_MAP").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.BLOB); version.onTable("HFJ_SEARCH") - .modifyColumn("SEARCH_UUID").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 36); + .modifyColumn("SEARCH_UUID").nonNullable().withType("20190905.7", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 36); - version.onTable("HFJ_SEARCH_PARM").dropThisTable(); + version.onTable("HFJ_SEARCH_PARM").dropThisTable("20190905.8"); - version.onTable("HFJ_SPIDX_COORDS").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); - version.onTable("HFJ_SPIDX_DATE").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); - version.onTable("HFJ_SPIDX_STRING").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); - version.onTable("HFJ_SPIDX_STRING").addColumn("HASH_IDENTITY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); + version.onTable("HFJ_SPIDX_COORDS").modifyColumn("RES_TYPE").nonNullable().withType("20190905.9", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); + version.onTable("HFJ_SPIDX_DATE").modifyColumn("RES_TYPE").nonNullable().withType("20190905.10", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); + version.onTable("HFJ_SPIDX_STRING").modifyColumn("RES_TYPE").nonNullable().withType("20190905.11", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); + version.onTable("HFJ_SPIDX_STRING").addColumn("20190905.12", "HASH_IDENTITY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); version.onTable("HFJ_SPIDX_STRING").addIndex("IDX_SP_STRING_HASH_IDENT").unique(false).withColumns("HASH_IDENTITY"); - version.onTable("HFJ_SPIDX_COORDS").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); - version.onTable("HFJ_SPIDX_QUANTITY").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); - version.onTable("HFJ_SPIDX_QUANTITY").dropColumn("HASH_UNITS_AND_VALPREFIX"); - version.onTable("HFJ_SPIDX_QUANTITY").dropColumn("HASH_VALPREFIX"); - version.onTable("HFJ_SPIDX_NUMBER").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); - version.onTable("HFJ_SPIDX_TOKEN").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); - version.onTable("HFJ_SPIDX_URI").modifyColumn("RES_TYPE").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); - version.onTable("HFJ_SPIDX_URI").modifyColumn("SP_URI").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 254); - - version.onTable("TRM_CODESYSTEM").modifyColumn("CODE_SYSTEM_URI").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); - version.onTable("TRM_CODESYSTEM").modifyColumn("CS_NAME").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); - version.onTable("TRM_CODESYSTEM_VER").modifyColumn("CS_VERSION_ID").nullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + version.onTable("HFJ_SPIDX_COORDS").modifyColumn("RES_TYPE").nonNullable().withType("20190905.13", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); + version.onTable("HFJ_SPIDX_QUANTITY").modifyColumn("RES_TYPE").nonNullable().withType("20190905.14", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); + version.onTable("HFJ_SPIDX_QUANTITY").dropColumn("20190905.13", "HASH_UNITS_AND_VALPREFIX"); + version.onTable("HFJ_SPIDX_QUANTITY").dropColumn("20190905.14", "HASH_VALPREFIX"); + version.onTable("HFJ_SPIDX_NUMBER").modifyColumn("RES_TYPE").nonNullable().withType("20190905.15", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); + version.onTable("HFJ_SPIDX_TOKEN").modifyColumn("RES_TYPE").nonNullable().withType("20190905.16", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); + version.onTable("HFJ_SPIDX_URI").modifyColumn("RES_TYPE").nonNullable().withType("20190905.17", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 100); + version.onTable("HFJ_SPIDX_URI").modifyColumn("SP_URI").nullable().withType("20190905.18", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 254); + + version.onTable("TRM_CODESYSTEM").modifyColumn("CODE_SYSTEM_URI").nonNullable().withType("20190905.19", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + version.onTable("TRM_CODESYSTEM").modifyColumn("CS_NAME").nullable().withType("20190905.20", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + version.onTable("TRM_CODESYSTEM_VER").modifyColumn("CS_VERSION_ID").nullable().withType("20190905.21", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); } @@ -367,17 +368,17 @@ private void init360() { resourceLink .modifyColumn("SRC_PATH") .nonNullable() - .withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + .withType("20180929.1", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); // Search Builder.BuilderWithTableName search = version.onTable("HFJ_SEARCH"); version.startSectionWithMessage("Starting work on table: " + search.getTableName()); search - .addColumn("OPTLOCK_VERSION") + .addColumn("20181001.1", "OPTLOCK_VERSION") .nullable() .type(BaseTableColumnTypeTask.ColumnTypeEnum.INT); - version.addTableRawSql("HFJ_RES_REINDEX_JOB") + version.addTableRawSql("20181104.1", "HFJ_RES_REINDEX_JOB") .addSql(DriverTypeEnum.MSSQL_2012, "create table HFJ_RES_REINDEX_JOB (PID bigint not null, JOB_DELETED bit not null, RES_TYPE varchar(255), SUSPENDED_UNTIL datetime2, UPDATE_THRESHOLD_HIGH datetime2 not null, UPDATE_THRESHOLD_LOW datetime2, primary key (PID))") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "create table HFJ_RES_REINDEX_JOB (PID bigint not null, JOB_DELETED boolean not null, RES_TYPE varchar(255), SUSPENDED_UNTIL timestamp, UPDATE_THRESHOLD_HIGH timestamp not null, UPDATE_THRESHOLD_LOW timestamp, primary key (PID))") .addSql(DriverTypeEnum.MARIADB_10_1, "create table HFJ_RES_REINDEX_JOB (PID bigint not null, JOB_DELETED bit not null, RES_TYPE varchar(255), SUSPENDED_UNTIL datetime(6), UPDATE_THRESHOLD_HIGH datetime(6) not null, UPDATE_THRESHOLD_LOW datetime(6), primary key (PID))") @@ -385,13 +386,13 @@ private void init360() { .addSql(DriverTypeEnum.MYSQL_5_7, " create table HFJ_RES_REINDEX_JOB (PID bigint not null, JOB_DELETED bit not null, RES_TYPE varchar(255), SUSPENDED_UNTIL datetime(6), UPDATE_THRESHOLD_HIGH datetime(6) not null, UPDATE_THRESHOLD_LOW datetime(6), primary key (PID))") .addSql(DriverTypeEnum.ORACLE_12C, "create table HFJ_RES_REINDEX_JOB (PID number(19,0) not null, JOB_DELETED number(1,0) not null, RES_TYPE varchar2(255 char), SUSPENDED_UNTIL timestamp, UPDATE_THRESHOLD_HIGH timestamp not null, UPDATE_THRESHOLD_LOW timestamp, primary key (PID))"); - version.onTable("TRM_CONCEPT_DESIG").addColumn("CS_VER_PID").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); - version.onTable("TRM_CONCEPT_DESIG").addForeignKey("FK_CONCEPTDESIG_CSV").toColumn("CS_VER_PID").references("TRM_CODESYSTEM_VER", "PID"); + version.onTable("TRM_CONCEPT_DESIG").addColumn("20181104.2", "CS_VER_PID").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); + version.onTable("TRM_CONCEPT_DESIG").addForeignKey("FK_CONCEPTDESIG_CSV").toColumn("CS_VER_PID").references("20181104.3", "TRM_CODESYSTEM_VER", "PID"); - version.onTable("TRM_CONCEPT_PROPERTY").addColumn("CS_VER_PID").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); - version.onTable("TRM_CONCEPT_PROPERTY").addForeignKey("FK_CONCEPTPROP_CSV").toColumn("CS_VER_PID").references("TRM_CODESYSTEM_VER", "PID"); + version.onTable("TRM_CONCEPT_PROPERTY").addColumn("20181104.4", "CS_VER_PID").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); + version.onTable("TRM_CONCEPT_PROPERTY").addForeignKey("FK_CONCEPTPROP_CSV").toColumn("CS_VER_PID").references("20181104.5", "TRM_CODESYSTEM_VER", "PID"); - version.onTable("TRM_CONCEPT").addColumn("PARENT_PIDS").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.CLOB); + version.onTable("TRM_CONCEPT").addColumn("20181104.6", "PARENT_PIDS").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.CLOB); } @@ -403,9 +404,9 @@ private void init350() { version.startSectionWithMessage("Starting work on table: " + forcedId.getTableName()); forcedId - .dropIndex("IDX_FORCEDID_TYPE_FORCEDID"); + .dropIndex("20180827.1", "IDX_FORCEDID_TYPE_FORCEDID"); forcedId - .dropIndex("IDX_FORCEDID_TYPE_RESID"); + .dropIndex("20180827.2", "IDX_FORCEDID_TYPE_RESID"); forcedId .addIndex("IDX_FORCEDID_TYPE_FID") @@ -416,18 +417,18 @@ private void init350() { Builder.BuilderWithTableName spidxCoords = version.onTable("HFJ_SPIDX_COORDS"); version.startSectionWithMessage("Starting work on table: " + spidxCoords.getTableName()); spidxCoords - .addColumn("HASH_IDENTITY") + .addColumn("20180903.1", "HASH_IDENTITY") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); if (!myFlags.contains(FlagEnum.NO_MIGRATE_HASHES)) { spidxCoords - .dropIndex("IDX_SP_COORDS"); + .dropIndex("20180903.2", "IDX_SP_COORDS"); spidxCoords .addIndex("IDX_SP_COORDS_HASH") .unique(false) .withColumns("HASH_IDENTITY", "SP_LATITUDE", "SP_LONGITUDE"); spidxCoords - .addTask(new CalculateHashesTask() + .addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.3") .setColumnName("HASH_IDENTITY") .addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(t.getResourceType(), t.getString("SP_NAME"))) ); @@ -437,20 +438,20 @@ private void init350() { Builder.BuilderWithTableName spidxDate = version.onTable("HFJ_SPIDX_DATE"); version.startSectionWithMessage("Starting work on table: " + spidxDate.getTableName()); spidxDate - .addColumn("HASH_IDENTITY") + .addColumn("20180903.4", "HASH_IDENTITY") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); if (!myFlags.contains(FlagEnum.NO_MIGRATE_HASHES)) { spidxDate - .dropIndex("IDX_SP_TOKEN"); + .dropIndex("20180903.4", "IDX_SP_TOKEN"); spidxDate .addIndex("IDX_SP_DATE_HASH") .unique(false) .withColumns("HASH_IDENTITY", "SP_VALUE_LOW", "SP_VALUE_HIGH"); spidxDate - .dropIndex("IDX_SP_DATE"); + .dropIndex("20180903.5", "IDX_SP_DATE"); spidxDate - .addTask(new CalculateHashesTask() + .addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.6") .setColumnName("HASH_IDENTITY") .addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(t.getResourceType(), t.getString("SP_NAME"))) ); @@ -460,18 +461,18 @@ private void init350() { Builder.BuilderWithTableName spidxNumber = version.onTable("HFJ_SPIDX_NUMBER"); version.startSectionWithMessage("Starting work on table: " + spidxNumber.getTableName()); spidxNumber - .addColumn("HASH_IDENTITY") + .addColumn("20180903.7", "HASH_IDENTITY") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); if (!myFlags.contains(FlagEnum.NO_MIGRATE_HASHES)) { spidxNumber - .dropIndex("IDX_SP_NUMBER"); + .dropIndex("20180903.8", "IDX_SP_NUMBER"); spidxNumber .addIndex("IDX_SP_NUMBER_HASH_VAL") .unique(false) .withColumns("HASH_IDENTITY", "SP_VALUE"); spidxNumber - .addTask(new CalculateHashesTask() + .addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.9") .setColumnName("HASH_IDENTITY") .addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(t.getResourceType(), t.getString("SP_NAME"))) ); @@ -481,20 +482,20 @@ private void init350() { Builder.BuilderWithTableName spidxQuantity = version.onTable("HFJ_SPIDX_QUANTITY"); version.startSectionWithMessage("Starting work on table: " + spidxQuantity.getTableName()); spidxQuantity - .addColumn("HASH_IDENTITY") + .addColumn("20180903.10", "HASH_IDENTITY") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); spidxQuantity - .addColumn("HASH_IDENTITY_SYS_UNITS") + .addColumn("20180903.11", "HASH_IDENTITY_SYS_UNITS") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); spidxQuantity - .addColumn("HASH_IDENTITY_AND_UNITS") + .addColumn("20180903.12", "HASH_IDENTITY_AND_UNITS") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); if (!myFlags.contains(FlagEnum.NO_MIGRATE_HASHES)) { spidxQuantity - .dropIndex("IDX_SP_QUANTITY"); + .dropIndex("20180903.13", "IDX_SP_QUANTITY"); spidxQuantity .addIndex("IDX_SP_QUANTITY_HASH") .unique(false) @@ -508,7 +509,7 @@ private void init350() { .unique(false) .withColumns("HASH_IDENTITY_SYS_UNITS", "SP_VALUE"); spidxQuantity - .addTask(new CalculateHashesTask() + .addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.14") .setColumnName("HASH_IDENTITY") .addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(t.getResourceType(), t.getString("SP_NAME"))) .addCalculator("HASH_IDENTITY_AND_UNITS", t -> ResourceIndexedSearchParamQuantity.calculateHashUnits(t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_UNITS"))) @@ -520,18 +521,18 @@ private void init350() { Builder.BuilderWithTableName spidxString = version.onTable("HFJ_SPIDX_STRING"); version.startSectionWithMessage("Starting work on table: " + spidxString.getTableName()); spidxString - .addColumn("HASH_NORM_PREFIX") + .addColumn("20180903.15", "HASH_NORM_PREFIX") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); if (!myFlags.contains(FlagEnum.NO_MIGRATE_HASHES)) { spidxString - .dropIndex("IDX_SP_STRING"); + .dropIndex("20180903.16", "IDX_SP_STRING"); spidxString .addIndex("IDX_SP_STRING_HASH_NRM") .unique(false) .withColumns("HASH_NORM_PREFIX", "SP_VALUE_NORMALIZED"); spidxString - .addColumn("HASH_EXACT") + .addColumn("20180903.17", "HASH_EXACT") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); spidxString @@ -539,7 +540,7 @@ private void init350() { .unique(false) .withColumns("HASH_EXACT"); spidxString - .addTask(new CalculateHashesTask() + .addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.18") .setColumnName("HASH_NORM_PREFIX") .addCalculator("HASH_NORM_PREFIX", t -> ResourceIndexedSearchParamString.calculateHashNormalized(new ModelConfig(), t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_VALUE_NORMALIZED"))) .addCalculator("HASH_EXACT", t -> ResourceIndexedSearchParamString.calculateHashExact(t.getResourceType(), t.getParamName(), t.getString("SP_VALUE_EXACT"))) @@ -550,26 +551,26 @@ private void init350() { Builder.BuilderWithTableName spidxToken = version.onTable("HFJ_SPIDX_TOKEN"); version.startSectionWithMessage("Starting work on table: " + spidxToken.getTableName()); spidxToken - .addColumn("HASH_IDENTITY") + .addColumn("20180903.19", "HASH_IDENTITY") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); spidxToken - .addColumn("HASH_SYS") + .addColumn("20180903.20", "HASH_SYS") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); spidxToken - .addColumn("HASH_SYS_AND_VALUE") + .addColumn("20180903.21", "HASH_SYS_AND_VALUE") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); spidxToken - .addColumn("HASH_VALUE") + .addColumn("20180903.22", "HASH_VALUE") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); if (!myFlags.contains(FlagEnum.NO_MIGRATE_HASHES)) { spidxToken - .dropIndex("IDX_SP_TOKEN"); + .dropIndex("20180903.23", "IDX_SP_TOKEN"); spidxToken - .dropIndex("IDX_SP_TOKEN_UNQUAL"); + .dropIndex("20180903.24", "IDX_SP_TOKEN_UNQUAL"); spidxToken .addIndex("IDX_SP_TOKEN_HASH") .unique(false) @@ -587,7 +588,7 @@ private void init350() { .unique(false) .withColumns("HASH_VALUE"); spidxToken - .addTask(new CalculateHashesTask() + .addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.25") .setColumnName("HASH_IDENTITY") .addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(t.getResourceType(), t.getString("SP_NAME"))) .addCalculator("HASH_SYS", t -> ResourceIndexedSearchParamToken.calculateHashSystem(t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM"))) @@ -600,7 +601,7 @@ private void init350() { Builder.BuilderWithTableName spidxUri = version.onTable("HFJ_SPIDX_URI"); version.startSectionWithMessage("Starting work on table: " + spidxUri.getTableName()); spidxUri - .addColumn("HASH_IDENTITY") + .addColumn("20180903.26", "HASH_IDENTITY") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); if (!myFlags.contains(FlagEnum.NO_MIGRATE_HASHES)) { @@ -609,7 +610,7 @@ private void init350() { .unique(false) .withColumns("HASH_IDENTITY", "SP_URI"); spidxUri - .addColumn("HASH_URI") + .addColumn("20180903.27", "HASH_URI") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); spidxUri @@ -617,7 +618,7 @@ private void init350() { .unique(false) .withColumns("HASH_URI"); spidxUri - .addTask(new CalculateHashesTask() + .addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.28") .setColumnName("HASH_IDENTITY") .addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(t.getResourceType(), t.getString("SP_NAME"))) .addCalculator("HASH_URI", t -> ResourceIndexedSearchParamUri.calculateHashUri(t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_URI"))) @@ -627,9 +628,9 @@ private void init350() { // Search Parameter Presence Builder.BuilderWithTableName spp = version.onTable("HFJ_RES_PARAM_PRESENT"); version.startSectionWithMessage("Starting work on table: " + spp.getTableName()); - spp.dropIndex("IDX_RESPARMPRESENT_SPID_RESID"); + spp.dropIndex("20180903.29", "IDX_RESPARMPRESENT_SPID_RESID"); spp - .addColumn("HASH_PRESENCE") + .addColumn("20180903.30", "HASH_PRESENCE") .nullable() .type(AddColumnTask.ColumnTypeEnum.LONG); spp @@ -637,7 +638,7 @@ private void init350() { .unique(false) .withColumns("HASH_PRESENCE"); - ArbitrarySqlTask consolidateSearchParamPresenceIndexesTask = new ArbitrarySqlTask("HFJ_SEARCH_PARM", "Consolidate search parameter presence indexes"); + ArbitrarySqlTask consolidateSearchParamPresenceIndexesTask = new ArbitrarySqlTask(VersionEnum.V3_5_0, "20180903.31", "HFJ_SEARCH_PARM", "Consolidate search parameter presence indexes"); consolidateSearchParamPresenceIndexesTask.setExecuteOnlyIfTableExists("HFJ_SEARCH_PARM"); consolidateSearchParamPresenceIndexesTask.setBatchSize(1); @@ -659,13 +660,13 @@ private void init350() { version.addTask(consolidateSearchParamPresenceIndexesTask); // SP_ID is no longer needed - spp.dropColumn("SP_ID"); + spp.dropColumn("20180903.32", "SP_ID"); // Concept Builder.BuilderWithTableName trmConcept = version.onTable("TRM_CONCEPT"); version.startSectionWithMessage("Starting work on table: " + trmConcept.getTableName()); trmConcept - .addColumn("CONCEPT_UPDATED") + .addColumn("20180903.33", "CONCEPT_UPDATED") .nullable() .type(BaseTableColumnTypeTask.ColumnTypeEnum.DATE_TIMESTAMP); trmConcept @@ -675,12 +676,12 @@ private void init350() { trmConcept .modifyColumn("CODE") .nonNullable() - .withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); + .withType("20180903.34", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500); // Concept Designation version.startSectionWithMessage("Starting work on table: TRM_CONCEPT_DESIG"); version - .addTableRawSql("TRM_CONCEPT_DESIG") + .addTableRawSql("20180907.1", "TRM_CONCEPT_DESIG") .addSql(DriverTypeEnum.H2_EMBEDDED, "create table TRM_CONCEPT_DESIG (PID bigint not null, LANG varchar(500), USE_CODE varchar(500), USE_DISPLAY varchar(500), USE_SYSTEM varchar(500), VAL varchar(500) not null, CS_VER_PID bigint, CONCEPT_PID bigint, primary key (PID))") .addSql(DriverTypeEnum.H2_EMBEDDED, "alter table TRM_CONCEPT_DESIG add constraint FK_CONCEPTDESIG_CSV foreign key (CS_VER_PID) references TRM_CODESYSTEM_VER") .addSql(DriverTypeEnum.H2_EMBEDDED, "alter table TRM_CONCEPT_DESIG add constraint FK_CONCEPTDESIG_CONCEPT foreign key (CONCEPT_PID) references TRM_CONCEPT") @@ -706,7 +707,7 @@ private void init350() { // Concept Property version.startSectionWithMessage("Starting work on table: TRM_CONCEPT_PROPERTY"); version - .addTableRawSql("TRM_CONCEPT_PROPERTY") + .addTableRawSql("20180907.2", "TRM_CONCEPT_PROPERTY") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "create table TRM_CONCEPT_PROPERTY (PID bigint not null, PROP_CODESYSTEM varchar(500), PROP_DISPLAY varchar(500), PROP_KEY varchar(500) not null, PROP_TYPE integer not null, PROP_VAL varchar(500), CS_VER_PID bigint, CONCEPT_PID bigint, primary key (PID))") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "alter table TRM_CONCEPT_PROPERTY add constraint FK_CONCEPTPROP_CSV foreign key (CS_VER_PID) references TRM_CODESYSTEM_VER") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "alter table TRM_CONCEPT_PROPERTY add constraint FK_CONCEPTPROP_CONCEPT foreign key (CONCEPT_PID) references TRM_CONCEPT") @@ -729,7 +730,7 @@ private void init350() { // Concept Map - Map version.startSectionWithMessage("Starting work on table: TRM_CONCEPT_MAP"); version - .addTableRawSql("TRM_CONCEPT_MAP") + .addTableRawSql("20180907.3", "TRM_CONCEPT_MAP") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "create table TRM_CONCEPT_MAP (PID bigint not null, RES_ID bigint, SOURCE_URL varchar(200), TARGET_URL varchar(200), URL varchar(200) not null, primary key (PID))") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "alter table TRM_CONCEPT_MAP add constraint FK_TRMCONCEPTMAP_RES foreign key (RES_ID) references HFJ_RESOURCE") .addSql(DriverTypeEnum.MYSQL_5_7, "create table TRM_CONCEPT_MAP (PID bigint not null, RES_ID bigint, SOURCE_URL varchar(200), TARGET_URL varchar(200), URL varchar(200) not null, primary key (PID))") @@ -751,7 +752,7 @@ private void init350() { // Concept Map - Group version.startSectionWithMessage("Starting work on table: TRM_CONCEPT_MAP_GROUP"); version - .addTableRawSql("TRM_CONCEPT_MAP_GROUP") + .addTableRawSql("20180907.4", "TRM_CONCEPT_MAP_GROUP") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "create table TRM_CONCEPT_MAP_GROUP (PID bigint not null, myConceptMapUrl varchar(255), SOURCE_URL varchar(200) not null, mySourceValueSet varchar(255), SOURCE_VERSION varchar(100), TARGET_URL varchar(200) not null, myTargetValueSet varchar(255), TARGET_VERSION varchar(100), CONCEPT_MAP_PID bigint not null, primary key (PID))") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "alter table TRM_CONCEPT_MAP_GROUP add constraint FK_TCMGROUP_CONCEPTMAP foreign key (CONCEPT_MAP_PID) references TRM_CONCEPT_MAP") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "create unique index IDX_CONCEPT_MAP_URL on TRM_CONCEPT_MAP (URL)") @@ -769,7 +770,7 @@ private void init350() { // Concept Map - Group Element version.startSectionWithMessage("Starting work on table: TRM_CONCEPT_MAP_GRP_ELEMENT"); version - .addTableRawSql("TRM_CONCEPT_MAP_GRP_ELEMENT") + .addTableRawSql("20180907.5", "TRM_CONCEPT_MAP_GRP_ELEMENT") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "create table TRM_CONCEPT_MAP_GRP_ELEMENT (PID bigint not null, SOURCE_CODE varchar(500) not null, myConceptMapUrl varchar(255), SOURCE_DISPLAY varchar(400), mySystem varchar(255), mySystemVersion varchar(255), myValueSet varchar(255), CONCEPT_MAP_GROUP_PID bigint not null, primary key (PID))") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "alter table TRM_CONCEPT_MAP_GRP_ELEMENT add constraint FK_TCMGELEMENT_GROUP foreign key (CONCEPT_MAP_GROUP_PID) references TRM_CONCEPT_MAP_GROUP") .addSql(DriverTypeEnum.MARIADB_10_1, "create table TRM_CONCEPT_MAP_GRP_ELEMENT (PID bigint not null, SOURCE_CODE varchar(500) not null, myConceptMapUrl varchar(255), SOURCE_DISPLAY varchar(400), mySystem varchar(255), mySystemVersion varchar(255), myValueSet varchar(255), CONCEPT_MAP_GROUP_PID bigint not null, primary key (PID))") @@ -792,7 +793,7 @@ private void init350() { // Concept Map - Group Element Target version.startSectionWithMessage("Starting work on table: TRM_CONCEPT_MAP_GRP_ELM_TGT"); version - .addTableRawSql("TRM_CONCEPT_MAP_GRP_ELM_TGT") + .addTableRawSql("20180907.6", "TRM_CONCEPT_MAP_GRP_ELM_TGT") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "create table TRM_CONCEPT_MAP_GRP_ELM_TGT (PID bigint not null, TARGET_CODE varchar(500) not null, myConceptMapUrl varchar(255), TARGET_DISPLAY varchar(400), TARGET_EQUIVALENCE varchar(50), mySystem varchar(255), mySystemVersion varchar(255), myValueSet varchar(255), CONCEPT_MAP_GRP_ELM_PID bigint not null, primary key (PID))") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "alter table TRM_CONCEPT_MAP_GRP_ELM_TGT add constraint FK_TCMGETARGET_ELEMENT foreign key (CONCEPT_MAP_GRP_ELM_PID) references TRM_CONCEPT_MAP_GRP_ELEMENT") .addSql(DriverTypeEnum.DERBY_EMBEDDED, "create index IDX_CNCPT_MP_GRP_ELM_TGT_CD on TRM_CONCEPT_MAP_GRP_ELM_TGT (TARGET_CODE)") @@ -812,7 +813,7 @@ private void init350() { .addSql(DriverTypeEnum.MSSQL_2012, "create index IDX_CNCPT_MP_GRP_ELM_TGT_CD on TRM_CONCEPT_MAP_GRP_ELM_TGT (TARGET_CODE)") .addSql(DriverTypeEnum.MSSQL_2012, "alter table TRM_CONCEPT_MAP_GRP_ELM_TGT add constraint FK_TCMGETARGET_ELEMENT foreign key (CONCEPT_MAP_GRP_ELM_PID) references TRM_CONCEPT_MAP_GRP_ELEMENT"); - version.onTable("HFJ_IDX_CMP_STRING_UNIQ").modifyColumn("IDX_STRING").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); + version.onTable("HFJ_IDX_CMP_STRING_UNIQ").modifyColumn("IDX_STRING").nonNullable().withType("20180907.6", BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); } @@ -836,27 +837,27 @@ private void init340() { Builder.BuilderWithTableName resourceLink = version.onTable("TRM_CODESYSTEM_VER"); version.startSectionWithMessage("Starting work on table: " + resourceLink.getTableName()); resourceLink - .dropIndex("IDX_CSV_RESOURCEPID_AND_VER"); + .dropIndex("20180929.1", "IDX_CSV_RESOURCEPID_AND_VER"); resourceLink - .dropColumn("RES_VERSION_ID"); + .dropColumn("20180929.2", "RES_VERSION_ID"); resourceLink - .addColumn("CS_VERSION_ID") + .addColumn("20180929.3", "CS_VERSION_ID") .nullable() .type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 255); resourceLink - .addColumn("CODESYSTEM_PID") + .addColumn("20180929.4", "CODESYSTEM_PID") .nullable() .type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); resourceLink .addForeignKey("FK_CODESYSVER_CS_ID") .toColumn("CODESYSTEM_PID") - .references("TRM_CODESYSTEM", "PID"); + .references("20180929.5", "TRM_CODESYSTEM", "PID"); // Concept Builder.BuilderWithTableName concept = version.onTable("TRM_CONCEPT"); version.startSectionWithMessage("Starting work on table: " + concept.getTableName()); concept - .addColumn("CODE_SEQUENCE") + .addColumn("20180929.6", "CODE_SEQUENCE") .nullable() .type(BaseTableColumnTypeTask.ColumnTypeEnum.INT); @@ -868,8 +869,8 @@ private void init330() { Builder.BuilderWithTableName hfjResource = version.onTable("HFJ_RESOURCE"); version.startSectionWithMessage("Starting work on table: " + hfjResource.getTableName()); - hfjResource.dropColumn("RES_TEXT"); - hfjResource.dropColumn("RES_ENCODING"); + hfjResource.dropColumn("20180601.1", "RES_TEXT"); + hfjResource.dropColumn("20180601.2", "RES_ENCODING"); Builder.BuilderWithTableName hfjResVer = version.onTable("HFJ_RES_VER"); version.startSectionWithMessage("Starting work on table: " + hfjResVer.getTableName()); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/BaseMigrationTasks.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/BaseMigrationTasks.java index b4837113edb4..77aaf90d42cd 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/BaseMigrationTasks.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/BaseMigrationTasks.java @@ -146,19 +146,20 @@ public void addSql(@Language("SQL") String theSql) { } public class BuilderAddTableByColumns extends BuilderWithTableName implements IAcceptsTasks { + private final String myVersion; private final AddTableByColumnTask myTask; public BuilderAddTableByColumns(String theRelease, String theVersion, IAcceptsTasks theSink, String theTableName, String thePkColumnName) { super(theRelease, theSink, theTableName); + myVersion = theVersion; myTask = new AddTableByColumnTask(myRelease, theVersion); myTask.setTableName(theTableName); myTask.setPkColumn(thePkColumnName); theSink.addTask(myTask); } - @Override - public BuilderWithTableName.BuilderAddColumnWithName addColumn(String theVersion, String theColumnName) { - return new BuilderWithTableName.BuilderAddColumnWithName(myRelease, theVersion, theColumnName, this); + public BuilderWithTableName.BuilderAddColumnWithName addColumn(String theColumnName) { + return new BuilderWithTableName.BuilderAddColumnWithName(myRelease, myVersion, theColumnName, this); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTest.java index c809412e6f05..dd1e975537e4 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTest.java @@ -15,7 +15,7 @@ public class AddColumnTest extends BaseTest { public void testColumnDoesntAlreadyExist() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); - AddColumnTask task = new AddColumnTask(); + AddColumnTask task = new AddColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("newcol"); task.setColumnType(AddColumnTask.ColumnTypeEnum.LONG); @@ -31,7 +31,7 @@ public void testColumnDoesntAlreadyExist() throws SQLException { public void testAddColumnInt() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); - AddColumnTask task = new AddColumnTask(); + AddColumnTask task = new AddColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("newcolint"); task.setColumnType(AddColumnTask.ColumnTypeEnum.INT); @@ -48,7 +48,7 @@ public void testAddColumnInt() throws SQLException { public void testColumnAlreadyExists() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255), newcol bigint)"); - AddColumnTask task = new AddColumnTask(); + AddColumnTask task = new AddColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("newcol"); task.setColumnType(AddColumnTask.ColumnTypeEnum.LONG); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTaskTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTaskTest.java index 0f955faaf2ca..e6a05ed6590e 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTaskTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTaskTest.java @@ -18,7 +18,7 @@ public void testAddForeignKey() throws SQLException { executeSql("create table FOREIGNTBL (PID bigint not null, HOMEREF bigint)"); assertThat(JdbcUtils.getForeignKeys(getConnectionProperties(), "HOME", "FOREIGNTBL"), empty()); - AddForeignKeyTask task = new AddForeignKeyTask(); + AddForeignKeyTask task = new AddForeignKeyTask("1", "1"); task.setTableName("FOREIGNTBL"); task.setColumnName("HOMEREF"); task.setConstraintName("FK_HOME_FOREIGN"); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTaskTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTaskTest.java index 10046e765211..b714761123c9 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTaskTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTaskTest.java @@ -39,7 +39,7 @@ private static class MyMigrationTasks extends BaseMigrationTasks { public MyMigrationTasks() { Builder v = forVersion(VersionEnum.V3_5_0); - v.addIdGenerator("SEQ_FOO"); + v.addIdGenerator("1", "SEQ_FOO"); } diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTest.java index 0f78c9e1ad75..06bcaa974a50 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTest.java @@ -16,7 +16,7 @@ public void testUniqueConstraintAlreadyExists() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); executeSql("ALTER TABLE SOMETABLE ADD CONSTRAINT IDX_ANINDEX UNIQUE(TEXTCOL)"); - AddIndexTask task = new AddIndexTask(); + AddIndexTask task = new AddIndexTask("1", "1"); task.setIndexName("IDX_ANINDEX"); task.setTableName("SOMETABLE"); task.setColumns("TEXTCOL"); @@ -38,7 +38,7 @@ public void testUniqueIndexAlreadyExists() throws SQLException { executeSql("create unique index IDX_ANINDEX on SOMETABLE (PID, TEXTCOL)"); executeSql("create unique index IDX_DIFINDEX on SOMETABLE (TEXTCOL)"); - AddIndexTask task = new AddIndexTask(); + AddIndexTask task = new AddIndexTask("1", "1"); task.setIndexName("IDX_ANINDEX"); task.setTableName("SOMETABLE"); task.setColumns("PID", "TEXTCOL"); @@ -59,7 +59,7 @@ public void testNonUniqueIndexAlreadyExists() throws SQLException { executeSql("create index IDX_ANINDEX on SOMETABLE (PID, TEXTCOL)"); executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)"); - AddIndexTask task = new AddIndexTask(); + AddIndexTask task = new AddIndexTask("1", "1"); task.setIndexName("IDX_ANINDEX"); task.setTableName("SOMETABLE"); task.setColumns("PID", "TEXTCOL"); @@ -79,7 +79,7 @@ public void testIndexDoesntAlreadyExist() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); executeSql("create unique index IDX_DIFINDEX on SOMETABLE (TEXTCOL)"); - AddIndexTask task = new AddIndexTask(); + AddIndexTask task = new AddIndexTask("1", "1"); task.setIndexName("IDX_ANINDEX"); task.setTableName("SOMETABLE"); task.setColumns("PID", "TEXTCOL"); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTaskTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTaskTest.java index a9ad9232648f..1a4f15f858e4 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTaskTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTaskTest.java @@ -27,15 +27,15 @@ private static class MyMigrationTasks extends BaseMigrationTasks { public MyMigrationTasks() { Builder v = forVersion(VersionEnum.V3_5_0); - Builder.BuilderWithTableName targetTable = v.addTableByColumns("TGT_TABLE", "PID"); - targetTable.addColumn("PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); + Builder.BuilderWithTableName targetTable = v.addTableByColumns("1", "TGT_TABLE", "PID"); + targetTable.addColumn("1", "PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); - Builder.BuilderAddTableByColumns fooTable = v.addTableByColumns("FOO_TABLE", "PID"); + Builder.BuilderAddTableByColumns fooTable = v.addTableByColumns("1", "FOO_TABLE", "PID"); fooTable.addColumn("PID").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); fooTable.addColumn("HELLO").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 200); fooTable.addColumn("COL_REF").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.LONG); fooTable.addIndex("IDX_HELLO").unique(true).withColumns("HELLO"); - fooTable.addForeignKey("FK_REF").toColumn("COL_REF").references("TGT_TABLE", "PID"); + fooTable.addForeignKey("FK_REF").toColumn("COL_REF").references("1", "TGT_TABLE", "PID"); } diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableTest.java index 31738111becd..359a0698dfce 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableTest.java @@ -14,7 +14,7 @@ public class AddTableTest extends BaseTest { @Test public void testTableDoesntAlreadyExist() throws SQLException { - AddTableRawSqlTask task = new AddTableRawSqlTask(); + AddTableRawSqlTask task = new AddTableRawSqlTask("1", "1"); task.setTableName("SOMETABLE"); task.addSql(DriverTypeEnum.H2_EMBEDDED, "create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); getMigrator().addTask(task); @@ -29,7 +29,7 @@ public void testTableAlreadyExists() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); assertThat(JdbcUtils.getTableNames(getConnectionProperties()), containsInAnyOrder("SOMETABLE")); - AddTableRawSqlTask task = new AddTableRawSqlTask(); + AddTableRawSqlTask task = new AddTableRawSqlTask("1", "1"); task.setTableName("SOMETABLE"); task.addSql(DriverTypeEnum.H2_EMBEDDED, "create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); getMigrator().addTask(task); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTaskTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTaskTest.java index eb4902b690b0..3de4b454790b 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTaskTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTaskTest.java @@ -22,7 +22,7 @@ public void test350MigrateSearchParams() { executeSql("insert into HFJ_RES_PARAM_PRESENT (PID, SP_ID, SP_PRESENT, HASH_PRESENT) values (100, 1, true, null)"); executeSql("insert into HFJ_RES_PARAM_PRESENT (PID, SP_ID, SP_PRESENT, HASH_PRESENT) values (101, 2, true, null)"); - ArbitrarySqlTask task = new ArbitrarySqlTask("HFJ_RES_PARAM_PRESENT", "Consolidate search parameter presence indexes"); + ArbitrarySqlTask task = new ArbitrarySqlTask(VersionEnum.V3_5_0, "1", "HFJ_RES_PARAM_PRESENT", "Consolidate search parameter presence indexes"); task.setExecuteOnlyIfTableExists("hfj_search_parm"); task.setBatchSize(1); String sql = "SELECT " + @@ -56,7 +56,7 @@ public void test350MigrateSearchParams() { @Test public void testExecuteOnlyIfTableExists() { - ArbitrarySqlTask task = new ArbitrarySqlTask("HFJ_RES_PARAM_PRESENT", "Consolidate search parameter presence indexes"); + ArbitrarySqlTask task = new ArbitrarySqlTask(VersionEnum.V3_5_0, "1", "HFJ_RES_PARAM_PRESENT", "Consolidate search parameter presence indexes"); task.setBatchSize(1); String sql = "SELECT * FROM HFJ_SEARCH_PARM"; task.addQuery(sql, ArbitrarySqlTask.QueryModeEnum.BATCH_UNTIL_NO_MORE, t -> { @@ -82,7 +82,7 @@ public void testUpdateTask() { }; migrator .forVersion(VersionEnum.V3_5_0) - .addTableRawSql("A") + .addTableRawSql("1", "A") .addSql("delete from TEST_UPDATE_TASK where RES_TYPE = 'Patient'"); getMigrator().addTasks(migrator.getTasks(VersionEnum.V3_3_0, VersionEnum.V3_6_0)); @@ -106,8 +106,8 @@ public void testArbitrarySql() { }; migrator .forVersion(VersionEnum.V3_5_0) - .executeRawSql(DriverTypeEnum.H2_EMBEDDED, "delete from TEST_UPDATE_TASK where RES_TYPE = 'Patient'") - .executeRawSql(DriverTypeEnum.H2_EMBEDDED, "delete from TEST_UPDATE_TASK where RES_TYPE = 'Encounter'"); + .executeRawSql("1", DriverTypeEnum.H2_EMBEDDED, "delete from TEST_UPDATE_TASK where RES_TYPE = 'Patient'") + .executeRawSql("2", DriverTypeEnum.H2_EMBEDDED, "delete from TEST_UPDATE_TASK where RES_TYPE = 'Encounter'"); getMigrator().addTasks(migrator.getTasks(VersionEnum.V3_3_0, VersionEnum.V3_6_0)); getMigrator().migrate(); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTest.java index 688b13a31bea..b66377948568 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTest.java @@ -2,6 +2,7 @@ import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; +import ca.uhn.fhir.util.VersionEnum; import org.junit.Test; import org.springframework.jdbc.core.JdbcTemplate; @@ -17,7 +18,7 @@ public void testCreateHashes() { executeSql("insert into HFJ_SPIDX_TOKEN (SP_MISSING, SP_NAME, RES_ID, RES_TYPE, SP_UPDATED, SP_SYSTEM, SP_VALUE, SP_ID) values (false, 'identifier', 999, 'Patient', '2018-09-03 07:44:49.196', 'urn:oid:1.2.410.100110.10.41308301', '88888888', 1)"); executeSql("insert into HFJ_SPIDX_TOKEN (SP_MISSING, SP_NAME, RES_ID, RES_TYPE, SP_UPDATED, SP_SYSTEM, SP_VALUE, SP_ID) values (false, 'identifier', 999, 'Patient', '2018-09-03 07:44:49.196', 'urn:oid:1.2.410.100110.10.41308301', '99999999', 2)"); - CalculateHashesTask task = new CalculateHashesTask(); + CalculateHashesTask task = new CalculateHashesTask(VersionEnum.V3_5_0, "1"); task.setTableName("HFJ_SPIDX_TOKEN"); task.setColumnName("HASH_IDENTITY"); task.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(t.getResourceType(), t.getString("SP_NAME"))); @@ -64,7 +65,7 @@ public void testCreateHashesLargeNumber() { }); assertEquals(777L, count.longValue()); - CalculateHashesTask task = new CalculateHashesTask(); + CalculateHashesTask task = new CalculateHashesTask(VersionEnum.V3_5_0, "1"); task.setTableName("HFJ_SPIDX_TOKEN"); task.setColumnName("HASH_IDENTITY"); task.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(t.getResourceType(), t.getString("SP_NAME"))); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropColumnTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropColumnTest.java index 000fd6eeb2f1..268e1d79fd2d 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropColumnTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropColumnTest.java @@ -14,7 +14,7 @@ public class DropColumnTest extends BaseTest { public void testDropColumn() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); - DropColumnTask task = new DropColumnTask(); + DropColumnTask task = new DropColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("TEXTCOL"); getMigrator().addTask(task); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTaskTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTaskTest.java index dd2e0b1cc220..906877a78a7e 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTaskTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTaskTest.java @@ -19,7 +19,7 @@ public void testDropForeignKey() throws SQLException { assertThat(JdbcUtils.getForeignKeys(getConnectionProperties(), "PARENT", "CHILD"), hasSize(1)); - DropForeignKeyTask task = new DropForeignKeyTask(); + DropForeignKeyTask task = new DropForeignKeyTask("1", "1"); task.setTableName("CHILD"); task.setParentTableName("PARENT"); task.setConstraintName("FK_MOM"); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTaskTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTaskTest.java index b7fd7ed6927c..108c382bc2a9 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTaskTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTaskTest.java @@ -32,7 +32,7 @@ private static class MyMigrationTasks extends BaseMigrationTasks { public MyMigrationTasks() { Builder v = forVersion(VersionEnum.V3_5_0); - v.dropIdGenerator("SEQ_FOO"); + v.dropIdGenerator("1", "SEQ_FOO"); } diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTest.java index 55ffa9e92047..88d5c42f8a6e 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTest.java @@ -16,7 +16,7 @@ public void testIndexAlreadyExists() throws SQLException { executeSql("create index IDX_ANINDEX on SOMETABLE (PID, TEXTCOL)"); executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)"); - DropIndexTask task = new DropIndexTask(); + DropIndexTask task = new DropIndexTask("1", "1"); task.setDescription("Drop an index"); task.setIndexName("IDX_ANINDEX"); task.setTableName("SOMETABLE"); @@ -32,7 +32,7 @@ public void testIndexDoesntAlreadyExist() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)"); - DropIndexTask task = new DropIndexTask(); + DropIndexTask task = new DropIndexTask("1", "1"); task.setDescription("Drop an index"); task.setIndexName("IDX_ANINDEX"); task.setTableName("SOMETABLE"); @@ -50,7 +50,7 @@ public void testConstraintAlreadyExists() throws SQLException { executeSql("create index IDX_ANINDEX on SOMETABLE (PID, TEXTCOL)"); executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)"); - DropIndexTask task = new DropIndexTask(); + DropIndexTask task = new DropIndexTask("1", "1"); task.setDescription("Drop an index"); task.setIndexName("IDX_ANINDEX"); task.setTableName("SOMETABLE"); @@ -66,7 +66,7 @@ public void testConstraintDoesntAlreadyExist() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)"); - DropIndexTask task = new DropIndexTask(); + DropIndexTask task = new DropIndexTask("1", "1"); task.setDescription("Drop an index"); task.setIndexName("IDX_ANINDEX"); task.setTableName("SOMETABLE"); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTest.java index a033d359d4d6..eb4fd4c16ca0 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTest.java @@ -18,7 +18,7 @@ public void testDropExistingTable() throws SQLException { executeSql("create index IDX_ANINDEX on SOMETABLE (PID, TEXTCOL)"); executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)"); - DropTableTask task = new DropTableTask(); + DropTableTask task = new DropTableTask("1", "1"); task.setTableName("SOMETABLE"); getMigrator().addTask(task); @@ -35,7 +35,7 @@ public void testDropTableWithForeignKey() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, REMOTEPID bigint not null, primary key (PID))"); executeSql("alter table SOMETABLE add constraint FK_MYFK foreign key (REMOTEPID) references FOREIGNTABLE;"); - DropTableTask task = new DropTableTask(); + DropTableTask task = new DropTableTask("1", "1"); task.setTableName("SOMETABLE"); getMigrator().addTask(task); @@ -49,7 +49,7 @@ public void testDropTableWithForeignKey() throws SQLException { @Test public void testDropNonExistingTable() throws SQLException { - DropTableTask task = new DropTableTask(); + DropTableTask task = new DropTableTask("1", "1"); task.setTableName("SOMETABLE"); getMigrator().addTask(task); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTest.java index 3a0a12c8237c..18b5b13683ae 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTest.java @@ -13,7 +13,7 @@ public class ModifyColumnTest extends BaseTest { public void testColumnWithJdbcTypeClob() throws SQLException { executeSql("create table SOMETABLE (TEXTCOL clob)"); - ModifyColumnTask task = new ModifyColumnTask(); + ModifyColumnTask task = new ModifyColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("TEXTCOL"); task.setColumnType(AddColumnTask.ColumnTypeEnum.STRING); @@ -36,7 +36,7 @@ public void testColumnWithJdbcTypeClob() throws SQLException { public void testColumnAlreadyExists() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255), newcol bigint)"); - ModifyColumnTask task = new ModifyColumnTask(); + ModifyColumnTask task = new ModifyColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("TEXTCOL"); task.setColumnType(AddColumnTask.ColumnTypeEnum.STRING); @@ -59,7 +59,7 @@ public void testColumnAlreadyExists() throws SQLException { public void testNoShrink_SameNullable() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255), newcol bigint)"); - ModifyColumnTask task = new ModifyColumnTask(); + ModifyColumnTask task = new ModifyColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("TEXTCOL"); task.setColumnType(AddColumnTask.ColumnTypeEnum.STRING); @@ -88,7 +88,7 @@ public void testColumnMakeNullable() throws SQLException { assertEquals(new JdbcUtils.ColumnType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 255), JdbcUtils.getColumnType(getConnectionProperties(), "SOMETABLE", "TEXTCOL")); // PID - ModifyColumnTask task = new ModifyColumnTask(); + ModifyColumnTask task = new ModifyColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("PID"); task.setColumnType(AddColumnTask.ColumnTypeEnum.LONG); @@ -96,7 +96,7 @@ public void testColumnMakeNullable() throws SQLException { getMigrator().addTask(task); // STRING - task = new ModifyColumnTask(); + task = new ModifyColumnTask("1", "2"); task.setTableName("SOMETABLE"); task.setColumnName("TEXTCOL"); task.setColumnType(AddColumnTask.ColumnTypeEnum.STRING); @@ -130,7 +130,7 @@ public void testNoShrink_ColumnMakeDateNullable() throws SQLException { getMigrator().setNoColumnShrink(true); // PID - ModifyColumnTask task = new ModifyColumnTask(); + ModifyColumnTask task = new ModifyColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("PID"); task.setColumnType(AddColumnTask.ColumnTypeEnum.LONG); @@ -138,7 +138,7 @@ public void testNoShrink_ColumnMakeDateNullable() throws SQLException { getMigrator().addTask(task); // STRING - task = new ModifyColumnTask(); + task = new ModifyColumnTask("1", "2"); task.setTableName("SOMETABLE"); task.setColumnName("DATECOL"); task.setColumnType(AddColumnTask.ColumnTypeEnum.DATE_TIMESTAMP); @@ -167,7 +167,7 @@ public void testColumnMakeNotNullable() throws SQLException { assertEquals(new JdbcUtils.ColumnType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 255), JdbcUtils.getColumnType(getConnectionProperties(), "SOMETABLE", "TEXTCOL")); // PID - ModifyColumnTask task = new ModifyColumnTask(); + ModifyColumnTask task = new ModifyColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("PID"); task.setColumnType(AddColumnTask.ColumnTypeEnum.LONG); @@ -175,7 +175,7 @@ public void testColumnMakeNotNullable() throws SQLException { getMigrator().addTask(task); // STRING - task = new ModifyColumnTask(); + task = new ModifyColumnTask("1", "2"); task.setTableName("SOMETABLE"); task.setColumnName("TEXTCOL"); task.setColumnType(AddColumnTask.ColumnTypeEnum.STRING); @@ -201,7 +201,7 @@ public void testColumnMakeNotNullable() throws SQLException { public void testColumnDoesntAlreadyExist() throws SQLException { executeSql("create table SOMETABLE (PID bigint, TEXTCOL varchar(255))"); - ModifyColumnTask task = new ModifyColumnTask(); + ModifyColumnTask task = new ModifyColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setColumnName("SOMECOLUMN"); task.setDescription("Make nullable"); diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTaskTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTaskTest.java index 53898614052c..7c0109495734 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTaskTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTaskTest.java @@ -18,7 +18,7 @@ public class RenameColumnTaskTest extends BaseTest { public void testColumnAlreadyExists() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); - RenameColumnTask task = new RenameColumnTask(); + RenameColumnTask task = new RenameColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setDescription("Drop an index"); task.setOldName("myTextCol"); @@ -34,7 +34,7 @@ public void testColumnAlreadyExists() throws SQLException { public void testBothExistDeleteTargetFirst() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255), myTextCol varchar(255))"); - RenameColumnTask task = new RenameColumnTask(); + RenameColumnTask task = new RenameColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setDescription("Drop an index"); task.setOldName("myTextCol"); @@ -53,7 +53,7 @@ public void testBothExistDeleteTargetFirstDataExistsInSourceAndTarget() throws S executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255), myTextCol varchar(255))"); executeSql("INSERT INTO SOMETABLE (PID, TEXTCOL, myTextCol) VALUES (123, 'AAA', 'BBB')"); - RenameColumnTask task = new RenameColumnTask(); + RenameColumnTask task = new RenameColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setDescription("Drop an index"); task.setOldName("myTextCol"); @@ -74,7 +74,7 @@ public void testBothExistDeleteTargetFirstDataExistsInSourceAndTarget() throws S public void testColumnDoesntAlreadyExist() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, myTextCol varchar(255))"); - RenameColumnTask task = new RenameColumnTask(); + RenameColumnTask task = new RenameColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setDescription("Drop an index"); task.setOldName("myTextCol"); @@ -90,7 +90,7 @@ public void testColumnDoesntAlreadyExist() throws SQLException { public void testNeitherColumnExists() { executeSql("create table SOMETABLE (PID bigint not null)"); - RenameColumnTask task = new RenameColumnTask(); + RenameColumnTask task = new RenameColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setOldName("myTextCol"); task.setNewName("TEXTCOL"); @@ -110,7 +110,7 @@ public void testNeitherColumnExists() { public void testNeitherColumnExistsButAllowed() { executeSql("create table SOMETABLE (PID bigint not null)"); - RenameColumnTask task = new RenameColumnTask(); + RenameColumnTask task = new RenameColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setOldName("myTextCol"); task.setNewName("TEXTCOL"); @@ -124,7 +124,7 @@ public void testNeitherColumnExistsButAllowed() { public void testBothColumnsExist() { executeSql("create table SOMETABLE (PID bigint not null, PID2 bigint)"); - RenameColumnTask task = new RenameColumnTask(); + RenameColumnTask task = new RenameColumnTask("1", "1"); task.setTableName("SOMETABLE"); task.setOldName("PID"); task.setNewName("PID2");