From a21cc5d3ad882839cbaed60b07fcfc252b65fe72 Mon Sep 17 00:00:00 2001 From: Paulo Gomes da Cruz Junior Date: Mon, 29 Apr 2024 14:29:44 -0700 Subject: [PATCH] fix(FSADT1-1313): adding fm to i association (#943) --- .../db/migration/V6__adding_fm_to_i.sql | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 legacy/src/test/resources/db/migration/V6__adding_fm_to_i.sql diff --git a/legacy/src/test/resources/db/migration/V6__adding_fm_to_i.sql b/legacy/src/test/resources/db/migration/V6__adding_fm_to_i.sql new file mode 100644 index 0000000000..86983f416f --- /dev/null +++ b/legacy/src/test/resources/db/migration/V6__adding_fm_to_i.sql @@ -0,0 +1,43 @@ +-- Create a new entry in the REGISTRY_COMPANY_TYPE_CODE table for the BCeID FM type in an idempotent way +MERGE INTO THE.REGISTRY_COMPANY_TYPE_CODE tgt +USING ( + SELECT 'FM' AS REGISTRY_COMPANY_TYPE_CODE, + 'Sole Proprietorship' AS DESCRIPTION, + TIMESTAMP '2023-11-29 00:00:00.0' AS EFFECTIVE_DATE, + TIMESTAMP '9999-12-31 00:00:00.0' AS EXPIRY_DATE, + TIMESTAMP '2023-11-29 13:00:40.0' AS UPDATE_TIMESTAMP + FROM DUAL +) src +ON (tgt.REGISTRY_COMPANY_TYPE_CODE = src.REGISTRY_COMPANY_TYPE_CODE) +WHEN MATCHED THEN + UPDATE SET + tgt.DESCRIPTION = src.DESCRIPTION, + tgt.EFFECTIVE_DATE = src.EFFECTIVE_DATE, + tgt.EXPIRY_DATE = src.EXPIRY_DATE, + tgt.UPDATE_TIMESTAMP = src.UPDATE_TIMESTAMP +WHEN NOT MATCHED THEN + INSERT (REGISTRY_COMPANY_TYPE_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) + VALUES (src.REGISTRY_COMPANY_TYPE_CODE, src.DESCRIPTION, src.EFFECTIVE_DATE, src.EXPIRY_DATE, src.UPDATE_TIMESTAMP); + +-- Create a new entry in the CLIENT_TYPE_COMPANY_XREF table for the BCeID FM code linking with I in an idempotent way +MERGE INTO THE.CLIENT_TYPE_COMPANY_XREF tgt +USING ( + SELECT 'I' AS CLIENT_TYPE_CODE, + 'FM' AS REGISTRY_COMPANY_TYPE_CODE, + 'CLIADMIN' AS ADD_USERID, + TIMESTAMP '2023-11-29 13:00:40.0' AS ADD_TIMESTAMP, + 'CLIADMIN' AS UPDATE_USERID, + TIMESTAMP '2023-11-29 13:00:40.0' AS UPDATE_TIMESTAMP + FROM DUAL +) src +ON (tgt.CLIENT_TYPE_CODE = src.CLIENT_TYPE_CODE AND tgt.REGISTRY_COMPANY_TYPE_CODE = src.REGISTRY_COMPANY_TYPE_CODE) +WHEN MATCHED THEN + UPDATE SET + tgt.ADD_USERID = src.ADD_USERID, + tgt.ADD_TIMESTAMP = src.ADD_TIMESTAMP, + tgt.UPDATE_USERID = src.UPDATE_USERID, + tgt.UPDATE_TIMESTAMP = src.UPDATE_TIMESTAMP +WHEN NOT MATCHED THEN + INSERT (CLIENT_TYPE_CODE, REGISTRY_COMPANY_TYPE_CODE, ADD_USERID, ADD_TIMESTAMP, UPDATE_USERID, UPDATE_TIMESTAMP) + VALUES (src.CLIENT_TYPE_CODE, src.REGISTRY_COMPANY_TYPE_CODE, src.ADD_USERID, src.ADD_TIMESTAMP, src.UPDATE_USERID, src.UPDATE_TIMESTAMP); +