-
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.
- Loading branch information
Showing
7 changed files
with
38 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- Deploy ggircs-portal:mutations/create_product_naics_mutation to pg | ||
-- requires: tables/product_naics | ||
|
||
begin; | ||
|
||
create or replace function ggircs_portal.create_product_naics_mutation( | ||
product_id_input int, | ||
naics_id_input int, | ||
is_mandatory_input boolean | ||
) returns void as $function$ | ||
|
||
-- Reset deleted at/by and update description on conflict | ||
insert into ggircs_portal.product_naics(product_id, naics_id, is_mandatory) | ||
values (product_id_input, naics_id_input, is_mandatory_input) | ||
on conflict(product_id, naics_id) do update set is_mandatory=is_mandatory_input, deleted_at=null, deleted_by=null; | ||
|
||
$function$ language sql volatile; | ||
|
||
grant execute on function ggircs_portal.create_product_naics_mutation to ciip_administrator; | ||
comment on function ggircs_portal.create_product_naics_mutation is 'This custom create mutation does an upsert on conflict of the product_id & naics_id columns, updating the is_mandatory column & setting the deleted at/by columns to null'; | ||
|
||
commit; |
File renamed without changes.
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:mutations/create_product_naics_mutation from pg | ||
|
||
BEGIN; | ||
|
||
-- XXX Add DDLs here. | ||
|
||
COMMIT; |
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Verify ggircs-portal:mutations/create_product_naics_mutation on pg | ||
|
||
BEGIN; | ||
|
||
-- XXX Add verifications here. | ||
|
||
ROLLBACK; |
File renamed without changes.