-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dropping cc application_revision_certification_url
- Loading branch information
Showing
7 changed files
with
68 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
schema/deploy/computed_columns/application_revision_certification_url@v1.16.0.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- Deploy ggircs-portal:computed_columns/application_revision_certification_url to pg | ||
-- requires: tables/certification_url | ||
|
||
begin; | ||
|
||
create or replace function ggircs_portal.application_revision_certification_url( | ||
application_revision ggircs_portal.application_revision | ||
) | ||
returns ggircs_portal.certification_url | ||
as | ||
$function$ | ||
declare | ||
result ggircs_portal.certification_url; | ||
begin | ||
select * from ggircs_portal.certification_url | ||
where certification_url.application_id = application_revision.application_id | ||
and certification_url.version_number = application_revision.version_number | ||
order by certification_url.created_at desc limit 1 into result; | ||
return result; | ||
end; | ||
$function$ | ||
language 'plpgsql' stable; | ||
|
||
grant execute on function ggircs_portal.application_revision_certification_url to ciip_administrator, ciip_analyst, ciip_industry_user; | ||
|
||
comment on function ggircs_portal.application_revision_certification_url is 'Computed column for graphql to traverse to a certification_url row from application_revision'; | ||
|
||
commit; |
25 changes: 23 additions & 2 deletions
25
schema/revert/computed_columns/application_revision_certification_url.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,28 @@ | ||
-- Revert ggircs-portal:computed_columns/application_revision_certification_url from pg | ||
-- Deploy ggircs-portal:computed_columns/application_revision_certification_url to pg | ||
-- requires: tables/certification_url | ||
|
||
begin; | ||
|
||
drop function ggircs_portal.application_revision_certification_url; | ||
create or replace function ggircs_portal.application_revision_certification_url( | ||
application_revision ggircs_portal.application_revision | ||
) | ||
returns ggircs_portal.certification_url | ||
as | ||
$function$ | ||
declare | ||
result ggircs_portal.certification_url; | ||
begin | ||
select * from ggircs_portal.certification_url | ||
where certification_url.application_id = application_revision.application_id | ||
and certification_url.version_number = application_revision.version_number | ||
order by certification_url.created_at desc limit 1 into result; | ||
return result; | ||
end; | ||
$function$ | ||
language 'plpgsql' stable; | ||
|
||
grant execute on function ggircs_portal.application_revision_certification_url to ciip_administrator, ciip_analyst, ciip_industry_user; | ||
|
||
comment on function ggircs_portal.application_revision_certification_url is 'Computed column for graphql to traverse to a certification_url row from application_revision'; | ||
|
||
commit; |
7 changes: 7 additions & 0 deletions
7
schema/revert/computed_columns/application_revision_certification_url@v1.16.0.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Revert ggircs-portal:computed_columns/application_revision_certification_url from pg | ||
|
||
begin; | ||
|
||
drop function ggircs_portal.application_revision_certification_url; | ||
|
||
commit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
schema/verify/computed_columns/application_revision_certification_url@v1.16.0.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Verify ggircs-portal:computed_columns/application_revision_certification_url on pg | ||
|
||
begin; | ||
|
||
select pg_get_functiondef('ggircs_portal.application_revision_certification_url(ggircs_portal.application_revision)'::regprocedure); | ||
|
||
rollback; |