From 5f97428d38b0aec2a5bc5927e5907726f9d4f93e Mon Sep 17 00:00:00 2001 From: Nick Goupinets Date: Tue, 24 Nov 2020 15:50:56 -0500 Subject: [PATCH] Added schema migration steps for MDM --- .../ca/uhn/hapi/fhir/docs/server_jpa_empi/empi.md | 0 .../migrate/tasks/HapiFhirJpaMigrationTasks.java | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) delete mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_empi/empi.md diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_empi/empi.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_empi/empi.md deleted file mode 100644 index e69de29bb2d..00000000000 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 0d2ad898d7f..4695f179e23 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 @@ -68,7 +68,20 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks { init430(); // Replaced by 5.0.0 init500(); // 20200218 - 20200513 init501(); // 20200514 - 20200515 - init510(); // 20200516 - present + init510(); // 20200516 - 20201028 + init520(); // 20201029 - Present + } + + protected void init520() { + Builder version = forVersion(VersionEnum.V5_2_0); + + Builder.BuilderWithTableName mdmLink = version.onTable("MPI_LINK"); + mdmLink.addColumn("20201029.1", "GOLDEN_RESOURCE_PID").nonNullable().type(ColumnTypeEnum.LONG); + mdmLink.addColumn("20201029.2", "RULE_COUNT").nullable().type(ColumnTypeEnum.LONG); + mdmLink + .addForeignKey("20201029.3", "FK_EMPI_LINK_GOLDEN_RESOURCE") + .toColumn("GOLDEN_RESOURCE_PID") + .references("HFJ_RESOURCE", "RES_ID"); } protected void init510() {