Index name fix (#4921)

* Index name fix

* Build fix

* Test restore

* Revert change
This commit is contained in:
James Agnew 2023-05-20 17:29:56 -04:00 committed by GitHub
parent d932730525
commit 307e52f88f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 13 deletions

View File

@ -121,24 +121,35 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
.online(false) .online(false)
.withColumns("TAG_TYPE", "TAG_CODE", "TAG_SYSTEM", "TAG_ID", "TAG_VERSION", "TAG_USER_SELECTED"); .withColumns("TAG_TYPE", "TAG_CODE", "TAG_SYSTEM", "TAG_ID", "TAG_VERSION", "TAG_USER_SELECTED");
version.onTable("HFJ_RES_VER_PROV") version
.addIndex("20230510.1", "IDX_RESVERPROV_RES_VER_PID") .onTable("HFJ_RES_VER_PROV")
.addIndex("20230510.1", "IDX_RESVERPROV_RESVER_PID")
.unique(false) .unique(false)
.withColumns("RES_VER_PID") .withColumns("RES_VER_PID");
.failureAllowed();
version.onTable("HFJ_RES_VER_PROV") version
.onTable("HFJ_RES_VER_PROV")
.addIndex("20230510.2", "IDX_RESVERPROV_RES_PID") .addIndex("20230510.2", "IDX_RESVERPROV_RES_PID")
.unique(false) .unique(false)
.withColumns("RES_PID"); .withColumns("RES_PID");
version.onTable(ResourceHistoryTable.HFJ_RES_VER) version
.onTable(ResourceHistoryTable.HFJ_RES_VER)
.addColumn("20230510.4", "SOURCE_URI") .addColumn("20230510.4", "SOURCE_URI")
.nullable() .nullable()
.type(ColumnTypeEnum.STRING, 100); .type(ColumnTypeEnum.STRING, 100);
version.onTable(ResourceHistoryTable.HFJ_RES_VER) version
.onTable(ResourceHistoryTable.HFJ_RES_VER)
.addColumn("20230510.5", "REQUEST_ID") .addColumn("20230510.5", "REQUEST_ID")
.nullable() .nullable()
.type(ColumnTypeEnum.STRING, 16); .type(ColumnTypeEnum.STRING, 16);
version
.onTable("HFJ_RES_VER_PROV")
.addForeignKey("20230510.6", "FK_RESVERPROV_RES_PID")
.toColumn("RES_PID")
.references("HFJ_RESOURCE", "RES_ID");
} }
protected void init660() { protected void init660() {
@ -920,11 +931,11 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
.unique(false) .unique(false)
.withColumns("RES_ID"); .withColumns("RES_ID");
theVersion.onTable("HFJ_RES_VER_PROV") theVersion.onTable("HFJ_RES_VER_PROV")
.addIndex("20211210.3", "FK_RESVERPROV_RES_PID") .addIndex("20211210.3", "FK_RESVERPROV_RES_PID")
.unique(false) .unique(false)
.withColumns("RES_PID") .withColumns("RES_PID")
.doNothing() // This index is added below in a better form
.onlyAppliesToPlatforms(NON_AUTOMATIC_FK_INDEX_PLATFORMS); .onlyAppliesToPlatforms(NON_AUTOMATIC_FK_INDEX_PLATFORMS);
theVersion.onTable("HFJ_FORCED_ID") theVersion.onTable("HFJ_FORCED_ID")
@ -1543,7 +1554,8 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
resVerProv resVerProv
.addForeignKey("20190921.15", "FK_RESVERPROV_RES_PID") .addForeignKey("20190921.15", "FK_RESVERPROV_RES_PID")
.toColumn("RES_PID") .toColumn("RES_PID")
.references("HFJ_RESOURCE", "RES_ID"); .references("HFJ_RESOURCE", "RES_ID")
.doNothing(); // Added below in a better form
resVerProv.addColumn("SOURCE_URI").nullable().type(ColumnTypeEnum.STRING, 100); resVerProv.addColumn("SOURCE_URI").nullable().type(ColumnTypeEnum.STRING, 100);
resVerProv.addColumn("REQUEST_ID").nullable().type(ColumnTypeEnum.STRING, 16); resVerProv.addColumn("REQUEST_ID").nullable().type(ColumnTypeEnum.STRING, 16);
resVerProv.addIndex("20190921.16", "IDX_RESVERPROV_SOURCEURI").unique(false).withColumns("SOURCE_URI"); resVerProv.addIndex("20190921.16", "IDX_RESVERPROV_SOURCEURI").unique(false).withColumns("SOURCE_URI");

View File

@ -42,8 +42,7 @@ import static ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable.SOURCE_URI_LENGT
@Index(name = "IDX_RESVERPROV_SOURCEURI", columnList = "SOURCE_URI"), @Index(name = "IDX_RESVERPROV_SOURCEURI", columnList = "SOURCE_URI"),
@Index(name = "IDX_RESVERPROV_REQUESTID", columnList = "REQUEST_ID"), @Index(name = "IDX_RESVERPROV_REQUESTID", columnList = "REQUEST_ID"),
@Index(name = "IDX_RESVERPROV_RES_PID", columnList = "RES_PID"), @Index(name = "IDX_RESVERPROV_RES_PID", columnList = "RES_PID"),
@Index(name = "IDX_RESVERPROV_RES_VER_PID", columnList = "RES_VER_PID") @Index(name = "IDX_RESVERPROV_RESVER_PID", columnList = "RES_VER_PID")
}, uniqueConstraints = {
}) })
@Entity @Entity
public class ResourceHistoryProvenanceEntity extends BasePartitionable { public class ResourceHistoryProvenanceEntity extends BasePartitionable {

View File

@ -19,7 +19,6 @@
*/ */
package ca.uhn.fhir.jpa.model.entity; package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import org.apache.commons.lang3.builder.CompareToBuilder; import org.apache.commons.lang3.builder.CompareToBuilder;

View File

@ -6,7 +6,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.EnumSource;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource; import org.junit.jupiter.params.provider.ValueSource;