diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/SearchInclude.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/SearchInclude.java index 4ecfbdd6b1d..461aa74825d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/SearchInclude.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/SearchInclude.java @@ -28,6 +28,7 @@ import javax.persistence.ForeignKey; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.Index; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; @@ -35,7 +36,9 @@ import javax.persistence.Table; //@formatter:off @Entity -@Table(name = "HFJ_SEARCH_INCLUDE") +@Table(name = "HFJ_SEARCH_INCLUDE", indexes = { + @Index(name = "IDX_HFJ_SEARCH_INCLUDE_SRCHPID", columnList = "SEARCH_PID") +}) //@formatter:on public class SearchInclude implements Serializable { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java index fe1a490281e..054991caff5 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java @@ -100,6 +100,13 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks { // FHIR ids contain a subset of ascii, limited to 64 chars. .type(ColumnTypeEnum.STRING, 64); + // Add new Index to HFJ_SEARCH_INCLUDE on SEARCH_PID + version + .onTable("HFJ_SEARCH_INCLUDE") + .addIndex("20221207.1", "IDX_HFJ_SEARCH_INCLUDE_SRCHPID") + .unique(false) + .online(true) + .withColumns("SEARCH_PID"); } private void init620() {