diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/embedded/DatabaseInitializerHelper.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/embedded/DatabaseInitializerHelper.java index c9ab9321e3a..e501826079a 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/embedded/DatabaseInitializerHelper.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/embedded/DatabaseInitializerHelper.java @@ -19,6 +19,7 @@ */ package ca.uhn.fhir.jpa.embedded; +import ca.uhn.fhir.jpa.migrate.DriverTypeEnum; import ca.uhn.fhir.util.VersionEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,6 +27,10 @@ import org.slf4j.LoggerFactory; import java.net.URL; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static ca.uhn.fhir.jpa.migrate.DriverTypeEnum.H2_EMBEDDED; public class DatabaseInitializerHelper { private static final Logger ourLog = LoggerFactory.getLogger(DatabaseInitializerHelper.class); @@ -40,9 +45,61 @@ public class DatabaseInitializerHelper { public void insertPersistenceTestData(JpaEmbeddedDatabase theDatabase, VersionEnum theVersionEnum) { String fileName = - String.format("migration/releases/%s/data/%s.sql", theVersionEnum, theDatabase.getDriverType()); + String.format("migration/releases/%s/data/%s.sql", theVersionEnum, H2_EMBEDDED); String sql = getSqlFromResourceFile(fileName); - theDatabase.insertTestData(sql); + String newSql = convertSql(sql, theDatabase.getDriverType()); + theDatabase.insertTestData(newSql); + } + + private String convertSql(String sql, DriverTypeEnum driverType) { + switch (driverType) { + case MSSQL_2012 -> { + String result = sql.replace("true", "'true'").replace("TRUE", "'true'"); + result = result.replace("false","'false'").replace("FALSE", "'false'"); + + // replace BLOB NUMBER with MSSQL BLOB + result = convertToBinary(result, ""); + return result; + } + case POSTGRES_9_4 -> { + // replace BLOB NUMBER with Postgres BLOB + return convertToBinary(sql, "'"); + } + case ORACLE_12C -> { + // Regular expression to match the date format 'YYYY-MM-DD HH:MI:SS.SSSSS' + String blobPattern = "'\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d+'"; + String result = sql.replace("true", "1").replace("TRUE", "1"); + result = result.replace("false","0").replace("FALSE", "0"); + + // Regular expression to match the date format 'YYYY-MM-DD HH:MI:SS.SSSSS' + String datePattern = "'\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d+'"; + + // Replace all occurrences of the date format with SYSDATE + result = result.replaceAll(datePattern, "SYSDATE"); + + // replace BLOB NUMBER with ORACLE BLOB + result = convertToBinary(result, "'"); + return result; + } + } + return sql; + } + + private static String convertToBinary(String theSqlScript, String theReplacement) { + // find convert_to_binary functions + Pattern pattern = Pattern.compile("convert_to_binary\\((\\d+)\\)"); + Matcher matcher = pattern.matcher(theSqlScript); + + StringBuilder modifiedScript = new StringBuilder(); + + // Iterate through all matches and replace them with the number as a string + while (matcher.find()) { + String number = matcher.group(1); + String replacement = theReplacement + number + theReplacement; + matcher.appendReplacement(modifiedScript, replacement); + } + matcher.appendTail(modifiedScript); + return modifiedScript.toString(); } public String getSqlFromResourceFile(String theFileName) { diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_1_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_1_0/data/H2_EMBEDDED.sql index 429310aea2e..be778c3bf1a 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_1_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_1_0/data/H2_EMBEDDED.sql @@ -48,7 +48,7 @@ INSERT INTO HFJ_RESOURCE (RES_ID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, INSERT INTO HFJ_RESOURCE (RES_ID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, SP_HAS_LINKS, HASH_SHA256, SP_INDEX_STATUS, RES_LANGUAGE, SP_CMPSTR_UNIQ_PRESENT, SP_COORDS_PRESENT, SP_DATE_PRESENT, SP_NUMBER_PRESENT, SP_QUANTITY_PRESENT, SP_STRING_PRESENT, SP_TOKEN_PRESENT, SP_URI_PRESENT, RES_TYPE, RES_VER) VALUES (1780, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:26:08.82', '2023-05-01 15:26:08.82', FALSE, 'F30D68F5D00D440BD35E9CF7CCF1250234106A4B52AE016ACEE0F4291FB5AF5F', 1, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, 'CODESYSTEM', 1); INSERT INTO HFJ_RESOURCE (RES_ID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, SP_HAS_LINKS, HASH_SHA256, SP_INDEX_STATUS, RES_LANGUAGE, SP_CMPSTR_UNIQ_PRESENT, SP_COORDS_PRESENT, SP_DATE_PRESENT, SP_NUMBER_PRESENT, SP_QUANTITY_PRESENT, SP_STRING_PRESENT, SP_TOKEN_PRESENT, SP_URI_PRESENT, RES_TYPE, RES_VER) VALUES (1788, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:26:12.178', '2023-05-01 15:26:12.178', FALSE, 'EDBD79B1632719D08AA733AF7F99DE17009D1CE4605F439B4F5BDAAC98AABDD8', 1, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, 'VALUESET', 1); INSERT INTO HFJ_RESOURCE (RES_ID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, SP_HAS_LINKS, HASH_SHA256, SP_INDEX_STATUS, RES_LANGUAGE, SP_CMPSTR_UNIQ_PRESENT, SP_COORDS_PRESENT, SP_DATE_PRESENT, SP_NUMBER_PRESENT, SP_QUANTITY_PRESENT, SP_STRING_PRESENT, SP_TOKEN_PRESENT, SP_URI_PRESENT, RES_TYPE, RES_VER) VALUES (1796, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:26:12.422', '2023-05-01 15:26:12.422', FALSE, 'A71FACD8BB1828ACD8718959949D5A16BE31F2E350671C5326A8E0BB9799357E', 1, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, 'CONCEPTMAP', 1); -INSERT INTO HFJ_BINARY_STORAGE_BLOB (BLOB_ID, BLOB_DATA, CONTENT_TYPE, BLOB_HASH, PUBLISHED_DATE, RESOURCE_ID, BLOB_SIZE) VALUES ('QE7FP9VMEDPQTKOL9ENJXJEXBCIPTZKP2WOGWLMGDKJMKWXONGLLWBCUGDM2YH88ZXSG6V5PGDTSMQDMOXHEXBEFNOE0GIURJPOD', 1415364, 'APPLICATION/XML', 'D28743293C2FB67B72D06C80D055B66CCB58D70030E460450CD661AE2ED7225E', '2023-05-01 16:15:16.469', 'BINARY/2003', 36781); +INSERT INTO HFJ_BINARY_STORAGE_BLOB (BLOB_ID, BLOB_DATA, CONTENT_TYPE, BLOB_HASH, PUBLISHED_DATE, RESOURCE_ID, BLOB_SIZE) VALUES ('QE7FP9VMEDPQTKOL9ENJXJEXBCIPTZKP2WOGWLMGDKJMKWXONGLLWBCUGDM2YH88ZXSG6V5PGDTSMQDMOXHEXBEFNOE0GIURJPOD', convert_to_binary(1415364), 'APPLICATION/XML', 'D28743293C2FB67B72D06C80D055B66CCB58D70030E460450CD661AE2ED7225E', '2023-05-01 16:15:16.469', 'BINARY/2003', 36781); INSERT INTO HFJ_BLK_EXPORT_JOB (PID, CREATED_TIME, EXP_TIME, JOB_ID, REQUEST, EXP_SINCE, JOB_STATUS, STATUS_MESSAGE, STATUS_TIME, OPTLOCK) VALUES (1, '2023-05-01 16:31:20.175', '2023-05-01 18:31:20.175', '077DCFC3-DDC1-4C83-BD15-82867912F79D', '/$EXPORT?_OUTPUTFORMAT=APPLICATION%2FFHIR%2BNDJSON', '2023-04-30 16:31:20.171', 'COMPLETE', NULL, '2023-05-01 16:31:36.011', 1); INSERT INTO HFJ_BLK_EXPORT_COLLECTION (PID, TYPE_FILTER, RES_TYPE, OPTLOCK, JOB_PID) VALUES (131, NULL, 'PATIENT', 0, 1); INSERT INTO HFJ_BLK_EXPORT_COLFILE (PID, RES_ID, COLLECTION_PID) VALUES (13, '2018', 131); @@ -57,21 +57,21 @@ INSERT INTO HFJ_FORCED_ID (PID, PARTITION_DATE, PARTITION_ID, FORCED_ID, RESOURC INSERT INTO HFJ_FORCED_ID (PID, PARTITION_DATE, PARTITION_ID, FORCED_ID, RESOURCE_PID, RESOURCE_TYPE) VALUES (1633, NULL, NULL, 'LOINC-UNIVERSAL-ORDER-SET', 1788, 'VALUESET'); INSERT INTO HFJ_FORCED_ID (PID, PARTITION_DATE, PARTITION_ID, FORCED_ID, RESOURCE_PID, RESOURCE_TYPE) VALUES (1625, NULL, NULL, 'LOINC', 1780, 'CODESYSTEM'); INSERT INTO HFJ_FORCED_ID (PID, PARTITION_DATE, PARTITION_ID, FORCED_ID, RESOURCE_PID, RESOURCE_TYPE) VALUES (1641, NULL, NULL, 'LOINC-PARTS-TO-PUBCHEM', 1796, 'CONCEPTMAP'); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:22:37.199', '2023-05-01 15:22:37.199', 'JSONC', 1402207, 1, 'BINARY', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (2, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:22:38.041', '2023-05-01 15:22:38.041', 'JSONC', 1402208, 2, 'BINARY', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1698, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:24:16.677', '2023-05-01 15:24:16.677', 'JSONC', 1407184, 1628, 'PATIENT', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1800, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:34:17.768', '2023-05-01 15:34:17.768', 'JSONC', 1408666, 1800, 'ENCOUNTER', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (2003, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 16:15:16.426', '2023-05-01 16:15:16.426', 'JSONC', 1415365, 2003, 'BINARY', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (4, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:22:38.624', '2023-05-01 15:22:38.624', 'JSONC', 1402210, 4, 'SEARCHPARAMETER', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1803, NULL, NULL, NULL, 'R4', TRUE, '2023-05-01 15:39:22.913', '2023-05-01 15:39:22.913', 'JSONC', 1409943, 1803, 'SUBSCRIPTION', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1753, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:24:16.677', '2023-05-01 15:24:16.677', 'JSONC', 1407239, 1631, 'ENCOUNTER', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (2029, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 17:01:12.921', '2023-05-01 17:01:12.921', 'JSONC', 1415705, 2029, 'RISKASSESSMENT', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1910, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 16:11:07.727', '2023-05-01 16:11:07.727', 'JSONC', 1414688, 1910, 'LOCATION', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1905, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:54:03.963', '2023-05-01 15:54:03.963', 'JSONC', 1413281, 1905, 'PATIENT', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1906, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:54:05.296', '2023-05-01 15:54:05.296', 'JSONC', 1413284, 1906, 'PATIENT', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1788, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:26:12.178', '2023-05-01 15:26:12.178', 'JSONC', 1407374, 1788, 'VALUESET', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1780, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:26:08.82', '2023-05-01 15:26:08.82', 'JSONC', 1407282, 1780, 'CODESYSTEM', 1); -INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1796, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:26:12.422', '2023-05-01 15:26:12.422', 'JSONC', 1407382, 1796, 'CONCEPTMAP', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:22:37.199', '2023-05-01 15:22:37.199', 'JSONC', convert_to_binary(1402207), 1, 'BINARY', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (2, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:22:38.041', '2023-05-01 15:22:38.041', 'JSONC', convert_to_binary(1402208), 2, 'BINARY', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1698, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:24:16.677', '2023-05-01 15:24:16.677', 'JSONC', convert_to_binary(1407184), 1628, 'PATIENT', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1800, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:34:17.768', '2023-05-01 15:34:17.768', 'JSONC', convert_to_binary(1408666), 1800, 'ENCOUNTER', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (2003, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 16:15:16.426', '2023-05-01 16:15:16.426', 'JSONC', convert_to_binary(1415365), 2003, 'BINARY', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (4, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:22:38.624', '2023-05-01 15:22:38.624', 'JSONC', convert_to_binary(1402210), 4, 'SEARCHPARAMETER', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1803, NULL, NULL, NULL, 'R4', TRUE, '2023-05-01 15:39:22.913', '2023-05-01 15:39:22.913', 'JSONC', convert_to_binary(1409943), 1803, 'SUBSCRIPTION', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1753, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:24:16.677', '2023-05-01 15:24:16.677', 'JSONC', convert_to_binary(1407239), 1631, 'ENCOUNTER', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (2029, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 17:01:12.921', '2023-05-01 17:01:12.921', 'JSONC', convert_to_binary(1415705), 2029, 'RISKASSESSMENT', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1910, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 16:11:07.727', '2023-05-01 16:11:07.727', 'JSONC', convert_to_binary(1414688), 1910, 'LOCATION', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1905, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:54:03.963', '2023-05-01 15:54:03.963', 'JSONC', convert_to_binary(1413281), 1905, 'PATIENT', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1906, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:54:05.296', '2023-05-01 15:54:05.296', 'JSONC', convert_to_binary(1413284), 1906, 'PATIENT', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1788, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:26:12.178', '2023-05-01 15:26:12.178', 'JSONC', convert_to_binary(1407374), 1788, 'VALUESET', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1780, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:26:08.82', '2023-05-01 15:26:08.82', 'JSONC', convert_to_binary(1407282), 1780, 'CODESYSTEM', 1); +INSERT INTO HFJ_RES_VER (PID, PARTITION_DATE, PARTITION_ID, RES_DELETED_AT, RES_VERSION, HAS_TAGS, RES_PUBLISHED, RES_UPDATED, RES_ENCODING, RES_TEXT, RES_ID, RES_TYPE, RES_VER) VALUES (1796, NULL, NULL, NULL, 'R4', FALSE, '2023-05-01 15:26:12.422', '2023-05-01 15:26:12.422', 'JSONC', convert_to_binary(1407382), 1796, 'CONCEPTMAP', 1); INSERT INTO HFJ_TAG_DEF (TAG_ID, TAG_CODE, TAG_DISPLAY, TAG_SYSTEM, TAG_TYPE) VALUES (1, 'HAPI-EMPI', NULL, 'HTTPS://HAPIFHIR.ORG/NAMINGSYSTEM/MANAGING-EMPI-SYSTEM', 0); INSERT INTO HFJ_TAG_DEF (TAG_ID, TAG_CODE, TAG_DISPLAY, TAG_SYSTEM, TAG_TYPE) VALUES (2, 'IN_MEMORY', 'IN-MEMORY', 'HTTP://HAPIFHIR.IO/FHIR/STRUCTUREDEFINITION/SUBSCRIPTION-MATCHING-STRATEGY', 0); INSERT INTO HFJ_HISTORY_TAG (PID, PARTITION_DATE, PARTITION_ID, TAG_ID, RES_VER_PID, RES_ID, RES_TYPE) VALUES (2, NULL, NULL, 1, 1803, 1803, 'SUBSCRIPTION'); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_2_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_2_0/data/H2_EMBEDDED.sql index 5f167a74a07..ff7c3453653 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_2_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_2_0/data/H2_EMBEDDED.sql @@ -17,11 +17,11 @@ INSERT INTO MPI_LINK ( ) VALUES ( 1, '2023-04-05 15:16:26.43', - 1, + true, 'PATIENT', 0, 2, - 1, + true, 1906, 1.0, 1905, diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_3_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_3_0/data/H2_EMBEDDED.sql index 8e056578629..d9a1378878e 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_3_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_3_0/data/H2_EMBEDDED.sql @@ -21,21 +21,21 @@ INSERT INTO HFJ_RESOURCE ( ) VALUES ( 1702, 'R4', - 0, + false, '2023-06-15 09:58:42.92', '2023-06-15 09:58:42.92', - 0, + false, '6beed652b77f6c65d776e57341a0b5b0596ac9cfb0e8345a5a5cfbfaa59e2b62', 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, + false, + false, + false, + false, + false, + false, + false, + true, + true, 'Observation', 1 ); @@ -60,7 +60,7 @@ INSERT INTO HFJ_SPIDX_QUANTITY_NRML ( 1702, 'Observation', '2023-04-05 15:16:26.43', - 0, + false, 'value-quantity', 2, 'https://unitsofmeasure.org', diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_5_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_5_0/data/H2_EMBEDDED.sql index c640127e1b9..c49f0370f06 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_5_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_5_0/data/H2_EMBEDDED.sql @@ -23,22 +23,22 @@ INSERT INTO HFJ_RESOURCE ( VALUES ( 1656, 'R4', - 0, + false, '2023-06-15 09:58:42.92', '2023-06-15 09:58:42.92', - 0, + false, '6beed652b77f6c65d776e57341a0b5b0596ac9cfb0e8345a5a5cfbfaa59e2b62', 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 1, - 0, - 1, + false, + false, + false, + false, + true, + false, + false, + true, + false, + true, 'Observation', 1 ); @@ -67,22 +67,22 @@ INSERT INTO HFJ_RESOURCE ( ) VALUES ( 1654, 'R4', - 0, + false, '2023-06-15 09:58:42.95', '2023-06-15 09:58:42.95', - 0, + false, '712b39864f0650e6b9ffd7b4ffa7b2de5db4ceecbcbd76b1f1b8e152ed17fcd0', 1, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 1, + false, + false, + false, + false, + false, + false, + true, + true, + false, + true, 'VALUESET', 1 ); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_7_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_7_0/data/H2_EMBEDDED.sql index 17c78e1425e..ab0f21bcfcc 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_7_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V5_7_0/data/H2_EMBEDDED.sql @@ -19,7 +19,7 @@ INSERT INTO HFJ_RES_VER ( 1, '2024-04-05', 'R4', - 0, + false, '2023-06-01 15:54:05.296', '2023-06-01 15:54:05.296', 'JSON', @@ -51,11 +51,11 @@ INSERT INTO MPI_LINK ( ) VALUES ( 2, '2024-04-05 15:16:26.43', - 1, + true, 'Observation', 0, 2, - 1, + true, 1906, 1.0, 1702, diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_0_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_0_0/data/H2_EMBEDDED.sql index 64d50ee7806..e4bd609d03e 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_0_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_0_0/data/H2_EMBEDDED.sql @@ -20,7 +20,7 @@ INSERT INTO BT2_JOB_INSTANCE ( WORK_CHUNKS_PURGED ) VALUES ( '00161699-bcfe-428e-9ca2-caceb9645f8a', - 0, + false, 0, 0, '2023-07-06 14:24:10.845', @@ -37,7 +37,7 @@ INSERT INTO BT2_JOB_INSTANCE ( 200, 'Error message', 83006, - 1 + true ); INSERT INTO BT2_WORK_CHUNK ( diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_1_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_1_0/data/H2_EMBEDDED.sql index 4a16c2e8564..793109a7344 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_1_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_1_0/data/H2_EMBEDDED.sql @@ -21,7 +21,7 @@ INSERT INTO BT2_JOB_INSTANCE ( REPORT ) VALUES ( 'a59cb9c2-f699-44c7-bfee-93f1e6f68038', - 0, + false, 0, 0, '2023-08-06 14:24:10.845', @@ -38,6 +38,6 @@ INSERT INTO BT2_JOB_INSTANCE ( 200, 'Error message', 83006, - 1, + true, 72995 ); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_2_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_2_0/data/H2_EMBEDDED.sql index 20b881e66a0..56b6c515beb 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_2_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_2_0/data/H2_EMBEDDED.sql @@ -23,7 +23,7 @@ INSERT INTO BT2_JOB_INSTANCE ( UPDATE_TIME ) VALUES ( 'cf969d58-44a5-4493-89c1-437e637532eb', - 0, + false, 0, 0, '2023-08-06 14:24:10.845', @@ -40,9 +40,9 @@ INSERT INTO BT2_JOB_INSTANCE ( 200, 'Error message', 83006, - 1, + true, 72995, - 0, + false, '2023-08-06 14:24:10.875' ); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_3_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_3_0/data/H2_EMBEDDED.sql index f596d5ddb82..c9b66a90dd7 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_3_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_3_0/data/H2_EMBEDDED.sql @@ -23,23 +23,23 @@ INSERT INTO HFJ_RESOURCE ( ) VALUES ( 1670, 'R4', - 0, + false, '2023-06-15 09:58:42.92', '2023-06-15 09:58:42.92', '1670', - 0, + false, '6beed652b77f6c65d776e57341a0b5b0596ac9cfb0e8345a5a5cfbfaa59e2b62', 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 1, - 0, - 1, + false, + false, + false, + false, + true, + false, + false, + true, + false, + true, 'Observation', 1 ); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_6_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_6_0/data/H2_EMBEDDED.sql index 18b1fe9bdbf..b0862ccee42 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_6_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_6_0/data/H2_EMBEDDED.sql @@ -22,22 +22,22 @@ INSERT INTO HFJ_RESOURCE ( ) VALUES ( 1678, 'R4', - 0, + false, '2023-06-15 09:58:42.92', '2023-06-15 09:58:42.92', - 0, + false, '6beed652b77f6c65d776e57341a0b5b0596ac9cfb0e8345a5a5cfbfaa59e2b62', 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 1, - 1, - 0, + false, + false, + false, + false, + true, + false, + false, + true, + true, + false, 'Observation', 1 ); @@ -93,8 +93,8 @@ INSERT INTO MPI_LINK_AUD ( 2, 0, 1, - 0, - 1, + false, + true, 1, '2024-03-29 10:14:40.69', '2024-03-29 10:14:41.70', @@ -117,7 +117,7 @@ INSERT INTO HFJ_TAG_DEF ( 'display', 'https://github.com/hapifhir/hapi-fhir/ns/jpa/profile', 1, - 0, + false, 'V 1.0' ); @@ -132,5 +132,5 @@ INSERT INTO HFJ_RESOURCE_MODIFIED ( '1', '2024-03-30 10:14:41.70', 'Observation', - '{"operationType":"CREATE","attributes":{"attKey":"attValue"},"transactionId":"txId","mediaType":"json","messageKey":"messageKey","payloadId":"Observation/1","partitionId":{"allPartitions":true},"payloadVersion":"1","subscriptionId":"subId"}' + '{"operationType":"CREATE","attributes":{"attKey":"attValue"},"transactionId":"txId","mediaType":"json","messageKey":"messageKey","payloadId":"Observation/1","payloadVersion":"1","subscriptionId":"subId"}' ); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_8_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_8_0/data/H2_EMBEDDED.sql index cd68afd53a8..04695772ab3 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_8_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V6_8_0/data/H2_EMBEDDED.sql @@ -21,7 +21,7 @@ INSERT INTO HFJ_RES_VER ( 1, '2024-04-05 15:54:05.296', 'R4', - 0, + false, '2023-05-01 15:54:05.296', '2023-05-01 15:54:05.296', 'JSON', @@ -62,7 +62,7 @@ INSERT INTO BT2_JOB_INSTANCE ( WARNING_MSG ) VALUES ( '2eb2c28c-fa20-48df-9652-00669dcaea2c', - 0, + false, 0, 0, '2023-08-06 14:24:10.845', @@ -80,10 +80,10 @@ INSERT INTO BT2_JOB_INSTANCE ( 'Error message', 83006, '{"jobId":"ec0df47d-8741-41cb-ab77-ca7c00c4799d","batchSize":100}', - 1, + true, 72995, 'report', - 0, + false, '2023-08-06 14:24:10.875', 'Failed to reindex resource because unique search parameter unique-code could not be enforced.' ); @@ -183,7 +183,7 @@ INSERT INTO HFJ_SEARCH ( 1906, 'Patient', 5146583, - 7368816, + convert_to_binary(80008816), 8479927, 1212873581, '?_lastUpdated=le2021-05-31', diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_0_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_0_0/data/H2_EMBEDDED.sql index 65889672dc4..b07e188a04d 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_0_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_0_0/data/H2_EMBEDDED.sql @@ -28,7 +28,7 @@ INSERT INTO BT2_JOB_INSTANCE ( CLIENT_ID ) VALUES ( '79751e50-fbfc-479a-8e14-29bed1973d66', - 0, + false, 0, 0, '2023-08-06 14:24:10.845', @@ -46,10 +46,10 @@ INSERT INTO BT2_JOB_INSTANCE ( 'Error message', 83006, '{"jobId":"7be85199-0136-406e-93b8-cbe44f15aa6c","batchSize":100}', - 1, + true, 72995, 'report', - 0, + false, '2023-08-06 14:24:10.875', 'Failed to reindex resource because unique search parameter unique-code could not be enforced.', 'triggeringUser',