From 262a964a31d993d09d1e33754a0e3356c3ae8653 Mon Sep 17 00:00:00 2001 From: Jacob Stampe Mikkelsen Date: Sat, 23 May 2020 23:11:21 +0200 Subject: [PATCH] Add index on CONCEPT_PID on TRM_CONCEPT_PROPERTY to optimize a full-reindex of lucene index which can be needed when running in a docker container where the lucene files are discarded on redeploy. (#1637) Co-authored-by: James Agnew --- .../java/ca/uhn/fhir/jpa/entity/TermConceptProperty.java | 1 + .../fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptProperty.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptProperty.java index 13bb6b24a07..43d3c2021b5 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptProperty.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermConceptProperty.java @@ -37,6 +37,7 @@ import static org.apache.commons.lang3.StringUtils.length; @Entity @Table(name = "TRM_CONCEPT_PROPERTY", uniqueConstraints = { }, indexes = { + @Index(name = "IDX_CONCEPTPROP_CONCEPTPID", columnList = "CONCEPT_PID") }) public class TermConceptProperty implements Serializable { private static final long serialVersionUID = 1L; 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 4fda491d2aa..b8d5ca98f43 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 @@ -244,7 +244,10 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks { protected void init420() { // 20191015 - 20200217 Builder version = forVersion(VersionEnum.V4_2_0); - // TermValueSetConceptDesignation + // TRM_CONCEPT_PROPERTY + version.onTable("TRM_CONCEPT_PROPERTY").addIndex("20191217.1", "IDX_CONCEPTPROP_CONCEPTPID").unique(false).withColumns("CONCEPT_PID"); + + // TermValueSetConceptDesignation version.onTable("TRM_VALUESET_C_DESIGNATION").dropIndex("20200202.1", "IDX_VALUESET_C_DSGNTN_VAL").failureAllowed(); Builder.BuilderWithTableName searchTable = version.onTable("HFJ_SEARCH"); searchTable.dropIndex("20200203.1", "IDX_SEARCH_LASTRETURNED");