Skip to content

Commit

Permalink
feat: removing certification email and md5 triggers on certification_url
Browse files Browse the repository at this point in the history
  • Loading branch information
pbastia committed Mar 23, 2021
1 parent 34369e7 commit d3a74fc
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
12 changes: 12 additions & 0 deletions schema/deploy/tables/certification_url_001.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Deploy ggircs-portal:tables/certification_url_001 to pg
-- requires: tables/certification_url

BEGIN;

drop trigger _certification_request_email on ggircs_portal.certification_url;
drop trigger _signed_by_certifier_email on ggircs_portal.certification_url;
drop trigger _recertification_request on ggircs_portal.certification_url;
drop trigger _create_form_result_md5 on ggircs_portal.certification_url;
drop trigger _check_form_result_md5 on ggircs_portal.certification_url;

COMMIT;
31 changes: 31 additions & 0 deletions schema/revert/tables/certification_url_001.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- Revert ggircs-portal:tables/certification_url_001 from pg

BEGIN;


create trigger _create_form_result_md5
before insert on ggircs_portal.certification_url
for each row
execute procedure ggircs_portal_private.signature_md5();

create trigger _check_form_result_md5
before update of certification_signature on ggircs_portal.certification_url
for each row
execute procedure ggircs_portal_private.signature_md5();

create trigger _certification_request_email
before update of certifier_email on ggircs_portal.certification_url
for each row
execute procedure ggircs_portal_private.run_graphile_worker_job('certification_request');

create trigger _signed_by_certifier_email
before update of certification_signature on ggircs_portal.certification_url
for each row
execute procedure ggircs_portal_private.run_graphile_worker_job('signed_by_certifier');

create trigger _recertification_request
before update of recertification_request_sent on ggircs_portal.certification_url
for each row
execute procedure ggircs_portal_private.run_graphile_worker_job('recertification');

COMMIT;
1 change: 1 addition & 0 deletions schema/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,4 @@ policies/facility_policies_001 [policies/facility_policies] 2021-03-15T18:25:58Z
policies/form_result_policies_001 [policies/form_result_policies] 2021-03-15T18:51:08Z Pierre Bastianelli <pierre.bastianelli@gov.bc.ca> # remove certifier RLS on form_result table
database_functions/get_valid_applications_for_certifier [database_functions/get_valid_applications_for_certifier@v1.16.0] 2021-03-15T20:29:13Z Pierre Bastianelli <pierre.bastianelli@gov.bc.ca> # removing function as a part of certifier role deprecation
trigger_functions/run_graphile_worker_job [trigger_functions/run_graphile_worker_job@v1.16.0] 2021-03-15T20:44:38Z Pierre Bastianelli <pierre.bastianelli@gov.bc.ca> # removing jobs related to certification
tables/certification_url_001 [tables/certification_url] 2021-03-15T21:50:02Z Pierre Bastianelli <pierre.bastianelli@gov.bc.ca> # dropping triggers for removed functions
42 changes: 42 additions & 0 deletions schema/verify/tables/certification_url_001.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-- Verify ggircs-portal:tables/certification_url_001 on pg

BEGIN;

do $$
begin

if (select exists(select * from pg_trigger where tgname='_certification_request_email' and tgrelid='ggircs_portal.certification_url'::regclass)) then
raise exception 'trigger _certification_request_email exists on ggircs_portal.certification_url when it should not';
else
perform true;
end if;

if (select exists(select * from pg_trigger where tgname='_signed_by_certifier_email' and tgrelid='ggircs_portal.certification_url'::regclass)) then
raise exception 'trigger _signed_by_certifier_email exists on ggircs_portal.certification_url when it should not';
else
perform true;
end if;

if (select exists(select * from pg_trigger where tgname='_recertification_request' and tgrelid='ggircs_portal.certification_url'::regclass)) then
raise exception 'trigger _recertification_request exists on ggircs_portal.certification_url when it should not';
else
perform true;
end if;

if (select exists(select * from pg_trigger where tgname='_create_form_result_md5' and tgrelid='ggircs_portal.certification_url'::regclass)) then
raise exception 'trigger _create_form_result_md5 exists on ggircs_portal.certification_url when it should not';
else
perform true;
end if;

if (select exists(select * from pg_trigger where tgname='_check_form_result_md5' and tgrelid='ggircs_portal.certification_url'::regclass)) then
raise exception 'trigger _check_form_result_md5 exists on ggircs_portal.certification_url when it should not';
else
perform true;
end if;

end;
$$;


ROLLBACK;

0 comments on commit d3a74fc

Please sign in to comment.