Fix badly built migrations and indexes

This commit is contained in:
Tadgh 2021-12-16 01:49:28 -08:00
parent 700b614610
commit 6a333c08bc
4 changed files with 12 additions and 7 deletions

View File

@ -48,9 +48,8 @@ import java.util.Date;
@Table(name = "MPI_LINK", uniqueConstraints = {
// TODO GGG DROP this index, and instead use the below one
@UniqueConstraint(name = "IDX_EMPI_PERSON_TGT", columnNames = {"PERSON_PID", "TARGET_PID"}),
// v---- this one
@UniqueConstraint(name = "IDX_EMPI_GR_TGT", columnNames = {"GOLDEN_RESOURCE_PID", "TARGET_PID"}),
//TODO GGG revisit adding this: @UniqueConstraint(name = "IDX_EMPI_GR_TGT", columnNames = {"GOLDEN_RESOURCE_PID", "TARGET_PID"}),
//TODO GGG Should i make individual indices for PERSON/TARGET?
})
public class MdmLink implements IMdmLink {

View File

@ -95,14 +95,20 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
theVersion.onTable( "HFJ_HISTORY_TAG")
.addIndex("20211210.2", "IDX_RESHISTTAG_RESID" )
.unique(false)
.withColumns("RES_ID")
.onlyAppliesToPlatforms(NON_AUTOMATIC_FK_INDEX_PLATFORMS);
.withColumns("RES_ID");
theVersion.onTable( "HFJ_RES_VER_PROV")
.addIndex("20211210.3", "IDX_RESVERPROV_RESID" )
.addIndex("20211210.3", "FK_RESVERPROV_RES_PID" )
.unique(false)
.withColumns("RES_PID")
.onlyAppliesToPlatforms(NON_AUTOMATIC_FK_INDEX_PLATFORMS);
theVersion.onTable("HFJ_FORCED_ID")
.addIndex("20211210.4", "FK_FORCEDID_RESOURCE")
.unique(true)
.withColumns("RESOURCE_PID")
.onlyAppliesToPlatforms(NON_AUTOMATIC_FK_INDEX_PLATFORMS);
}
private void init570() {

View File

@ -57,7 +57,7 @@ import javax.persistence.UniqueConstraint;
* so don't reuse these names
*/
@Index(name = "IDX_FORCEID_FID", columnList = "FORCED_ID"),
@Index(name = "IDX_FORCEID_RESID", columnList = "RESOURCE_PID"),
//@Index(name = "IDX_FORCEID_RESID", columnList = "RESOURCE_PID"),
//TODO GGG potentiall add a type + res_id index here, specifically for deletion?
})
public class ForcedId extends BasePartitionable {

View File

@ -39,7 +39,7 @@ import javax.persistence.Table;
@Table(name = "HFJ_RES_VER_PROV", indexes = {
@Index(name = "IDX_RESVERPROV_SOURCEURI", columnList = "SOURCE_URI"),
@Index(name = "IDX_RESVERPROV_REQUESTID", columnList = "REQUEST_ID"),
@Index(name = "IDX_RESVERPROV_RESID", columnList = "RES_PID")
//@Index(name = "IDX_RESVERPROV_RESID", columnList = "RES_PID")
})
@Entity
public class ResourceHistoryProvenanceEntity extends BasePartitionable {