Skip to content

Commit

Permalink
feat: dropping cc certification_url_has_matches
Browse files Browse the repository at this point in the history
  • Loading branch information
pbastia committed Mar 23, 2021
1 parent 955807d commit b001e60
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,6 @@

begin;

create or replace function ggircs_portal.certification_url_hash_matches(
certification_url ggircs_portal.certification_url
)
returns boolean
as
$function$
declare
result boolean;
current_md5 bytea;
begin
current_md5 := (select ggircs_portal_private.current_form_results_md5(certification_url.application_id, certification_url.version_number));
select certification_url.form_results_md5 = current_md5 into result;
return result;
end;
$function$
language 'plpgsql' stable;

grant execute on function ggircs_portal.certification_url_hash_matches to ciip_administrator, ciip_analyst, ciip_industry_user;

comment on function ggircs_portal.certification_url_hash_matches is 'Computed column for graphql to traverse to show if the current hash of form results matches the form_results_md5 in certification_url';
drop function ggircs_portal.certification_url_hash_matches;

commit;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- Deploy ggircs-portal:computed_columns/certification_url_hash_matches_current to pg
-- requires: function_current_form_result_md5
-- requires: tables/certification_url

begin;

create or replace function ggircs_portal.certification_url_hash_matches(
certification_url ggircs_portal.certification_url
)
returns boolean
as
$function$
declare
result boolean;
current_md5 bytea;
begin
current_md5 := (select ggircs_portal_private.current_form_results_md5(certification_url.application_id, certification_url.version_number));
select certification_url.form_results_md5 = current_md5 into result;
return result;
end;
$function$
language 'plpgsql' stable;

grant execute on function ggircs_portal.certification_url_hash_matches to ciip_administrator, ciip_analyst, ciip_industry_user;

comment on function ggircs_portal.certification_url_hash_matches is 'Computed column for graphql to traverse to show if the current hash of form results matches the form_results_md5 in certification_url';

commit;
25 changes: 23 additions & 2 deletions schema/revert/computed_columns/certification_url_hash_matches.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
-- Revert ggircs-portal:computed_columns/certification_url_hash_matches from pg
-- Deploy ggircs-portal:computed_columns/certification_url_hash_matches_current to pg
-- requires: function_current_form_result_md5
-- requires: tables/certification_url

begin;

drop function ggircs_portal.certification_url_hash_matches;
create or replace function ggircs_portal.certification_url_hash_matches(
certification_url ggircs_portal.certification_url
)
returns boolean
as
$function$
declare
result boolean;
current_md5 bytea;
begin
current_md5 := (select ggircs_portal_private.current_form_results_md5(certification_url.application_id, certification_url.version_number));
select certification_url.form_results_md5 = current_md5 into result;
return result;
end;
$function$
language 'plpgsql' stable;

grant execute on function ggircs_portal.certification_url_hash_matches to ciip_administrator, ciip_analyst, ciip_industry_user;

comment on function ggircs_portal.certification_url_hash_matches is 'Computed column for graphql to traverse to show if the current hash of form results matches the form_results_md5 in certification_url';

commit;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Revert ggircs-portal:computed_columns/certification_url_hash_matches from pg

begin;

drop function ggircs_portal.certification_url_hash_matches;

commit;
1 change: 1 addition & 0 deletions schema/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,4 @@ policies/certification_url_policies [policies/certification_url_policies@v1.16.0
database_functions/verify_function_not_present 2021-03-12T00:26:55Z Pierre Bastianelli <pierre.bastianelli@gov.bc.ca> # Helper that throws if a function already exists, meant to verify drop operations
computed_columns/application_revision_certification_signature_is_valid [computed_columns/application_revision_certification_signature_is_valid@v1.16.0] 2021-03-11T23:59:49Z Pierre Bastianelli <pierre.bastianelli@gov.bc.ca> # Removing computed column as part of the certifier role deprecation
computed_columns/application_revision_certification_url [computed_columns/application_revision_certification_url@v1.16.0] 2021-03-12T00:43:24Z Pierre Bastianelli <pierre.bastianelli@gov.bc.ca> # dropping computed column as part of the certifier role deprecation
computed_columns/certification_url_hash_matches [computed_columns/certification_url_hash_matches@v1.16.0] 2021-03-12T21:59:41Z Pierre Bastianelli <pierre.bastianelli@gov.bc.ca> # dropping computed column as part of certifier role deprecation
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

begin;

select pg_get_functiondef('ggircs_portal.certification_url_hash_matches(ggircs_portal.certification_url)'::regprocedure);
select ggircs_portal_private.verify_function_not_present('ggircs_portal.certification_url_hash_matches');

rollback;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Verify ggircs-portal:computed_columns/certification_url_hash_matches on pg

begin;

select pg_get_functiondef('ggircs_portal.certification_url_hash_matches(ggircs_portal.certification_url)'::regprocedure);

rollback;

0 comments on commit b001e60

Please sign in to comment.