Skip to content

Commit

Permalink
fix(FSADT1-1313): adding fm to i association (#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj authored Apr 29, 2024
1 parent d9bb200 commit a21cc5d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions legacy/src/test/resources/db/migration/V6__adding_fm_to_i.sql
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit a21cc5d

Please sign in to comment.