Fixes broken Oracle migration (#4933)

This commit is contained in:
Nathan Doef 2023-05-23 17:06:27 -04:00 committed by GitHub
parent 93a4a7bb33
commit 970befad90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -122,11 +122,14 @@ 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");
// This migration is failing in Oracle because there is already an index created on column RES_VER_PID since it is a primary key.
// IDX_RESVERPROV_RESVER_PID is removed in 20230523.1
version version
.onTable("HFJ_RES_VER_PROV") .onTable("HFJ_RES_VER_PROV")
.addIndex("20230510.1", "IDX_RESVERPROV_RESVER_PID") .addIndex("20230510.1", "IDX_RESVERPROV_RESVER_PID")
.unique(false) .unique(false)
.withColumns("RES_VER_PID"); .withColumns("RES_VER_PID")
.failureAllowed();
version version
.onTable("HFJ_RES_VER_PROV") .onTable("HFJ_RES_VER_PROV")
@ -151,6 +154,10 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
.toColumn("RES_PID") .toColumn("RES_PID")
.references("HFJ_RESOURCE", "RES_ID"); .references("HFJ_RESOURCE", "RES_ID");
version
.onTable("HFJ_RES_VER_PROV")
.dropIndex("20230523.1", "IDX_RESVERPROV_RESVER_PID");
} }
protected void init660() { protected void init660() {

View File

@ -41,8 +41,7 @@ import static ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable.SOURCE_URI_LENGT
@Table(name = "HFJ_RES_VER_PROV", indexes = { @Table(name = "HFJ_RES_VER_PROV", indexes = {
@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_RESVER_PID", columnList = "RES_VER_PID")
}) })
@Entity @Entity
public class ResourceHistoryProvenanceEntity extends BasePartitionable { public class ResourceHistoryProvenanceEntity extends BasePartitionable {