diff --git a/database/STR_DSS_Data_Seeding_NONPROD_Sprint_4.sql b/database/STR_DSS_Data_Seeding_NONPROD_Sprint_4.sql new file mode 100644 index 00000000..7381e5a0 --- /dev/null +++ b/database/STR_DSS_Data_Seeding_NONPROD_Sprint_4.sql @@ -0,0 +1,31 @@ +/* STR DSS Sprint 4 NON-PROD Data Seeding */ + +MERGE INTO dss_organization AS tgt +USING ( SELECT * FROM (VALUES +('LG','LGTEST','Test Town'), +('LG','LGTEST2','Test City'), +('Platform','PLATFORMTEST2','Test Platform 2'), +('Platform','PLATFORMTEST','Test Platform 1')) +AS s (organization_type, organization_cd, organization_nm) +) AS src +ON (tgt.organization_cd=src.organization_cd) +WHEN matched and ( +tgt.organization_nm!=src.organization_nm or +tgt.organization_type!=src.organization_type) +THEN UPDATE SET +organization_nm=src.organization_nm, +organization_type=src.organization_type +WHEN NOT MATCHED +THEN INSERT (organization_type, organization_cd, organization_nm) +VALUES (src.organization_type, src.organization_cd, src.organization_nm); + +INSERT INTO dss_organization_contact_person +(is_primary, email_message_type, email_address_dsc, contacted_through_organization_id) +SELECT true, emt.email_message_type, :quoted_tester_email, o.organization_id +FROM dss_organization AS o, dss_email_message_type as emt +where o.organization_type='Platform' +and emt.email_message_type in ('Notice of Takedown','Takedown Request','Batch Takedown Request') +and NOT EXISTS ( +SELECT 1 +FROM dss_organization_contact_person AS ocp +WHERE o.organization_id=ocp.contacted_through_organization_id AND emt.email_message_type=ocp.email_message_type); diff --git a/database/STR_DSS_Data_Seeding_Sprint_4.sql b/database/STR_DSS_Data_Seeding_Sprint_4.sql index 98dbb34b..e4b67930 100644 --- a/database/STR_DSS_Data_Seeding_Sprint_4.sql +++ b/database/STR_DSS_Data_Seeding_Sprint_4.sql @@ -1,4 +1,4 @@ -/* STR DSS Sprint 4 NON-PROD Data Seeding */ +/* STR DSS Sprint 4 Mandatory Data Seeding */ MERGE INTO dss_access_request_status AS tgt USING ( SELECT * FROM (VALUES @@ -130,11 +130,7 @@ VALUES (src.user_role_cd, src.user_privilege_cd); MERGE INTO dss_organization AS tgt USING ( SELECT * FROM (VALUES ('BCGov','CEU','Provincial Compliance and Enforcement Unit'), -('BCGov','BC','BC Government Staff'), -('LG','LGTEST','Test Town'), -('LG','LGTEST2','Test City'), -('Platform','PLATFORMTEST2','Test Platform 2'), -('Platform','PLATFORMTEST','Test Platform 1')) +('BCGov','BC','BC Government Staff')) AS s (organization_type, organization_cd, organization_nm) ) AS src ON (tgt.organization_cd=src.organization_cd) @@ -147,14 +143,3 @@ organization_type=src.organization_type WHEN NOT MATCHED THEN INSERT (organization_type, organization_cd, organization_nm) VALUES (src.organization_type, src.organization_cd, src.organization_nm); - -INSERT INTO dss_organization_contact_person -(is_primary, email_message_type, email_address_dsc, contacted_through_organization_id) -SELECT true, emt.email_message_type, :quoted_tester_email, o.organization_id -FROM dss_organization AS o, dss_email_message_type as emt -where o.organization_type='Platform' -and emt.email_message_type in ('Notice of Takedown','Takedown Request','Batch Takedown Request') -and NOT EXISTS ( -SELECT 1 -FROM dss_organization_contact_person AS ocp -WHERE o.organization_id=ocp.contacted_through_organization_id AND emt.email_message_type=ocp.email_message_type);