-
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
1 parent
f4a1a0f
commit 5ed430b
Showing
4 changed files
with
67 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,42 @@ | ||
-- Deploy cif:tables/project_attachment to pg | ||
-- requires: tables/project | ||
-- requires: tables/attachment | ||
|
||
begin; | ||
|
||
create table cif.project_attachment | ||
( | ||
id integer primary key generated always as identity, | ||
project_id integer not null references cif.project(id), | ||
attachment_id integer not null references cif.attachment(id) | ||
); | ||
|
||
select cif_private.upsert_timestamp_columns('cif', 'project_attachment'); | ||
|
||
create unique index project_attachment_project_id_attachment_id_unique_index | ||
on cif.project_attachment (project_id, attachment_id) | ||
where archived_at is null; | ||
|
||
do | ||
$grant$ | ||
begin | ||
|
||
-- Grant cif_internal permissions | ||
perform cif_private.grant_permissions('select', 'project_attachment', 'cif_internal'); | ||
perform cif_private.grant_permissions('insert', 'project_attachment', 'cif_internal'); | ||
perform cif_private.grant_permissions('update', 'project_attachment', 'cif_internal'); | ||
|
||
-- Grant cif_admin permissions | ||
perform cif_private.grant_permissions('select', 'project_attachment', 'cif_admin'); | ||
perform cif_private.grant_permissions('insert', 'project_attachment', 'cif_admin'); | ||
perform cif_private.grant_permissions('update', 'project_attachment', 'cif_admin'); | ||
|
||
end | ||
$grant$; | ||
|
||
comment on table cif.project_attachment is 'Join table to track assignment of attachments to projects'; | ||
comment on column cif.project_attachment.id is 'Unique ID for the project attachment record'; | ||
comment on column cif.project_attachment.project_id is 'Foreign key to the project'; | ||
comment on column cif.project_attachment.attachment_id is 'Foreign key to the attachment'; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Revert cif:tables/project_attachment from pg | ||
|
||
begin; | ||
|
||
drop table cif.project_attachment; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,3 +289,4 @@ mutations/commit_project_revision [mutations/[email protected]] 2023 | |
@1.7.3 2023-05-02T23:54:44Z Sepehr Sobhani <[email protected]> # release v1.7.3 | ||
computed_columns/form_change_rank 2023-05-01T17:39:07Z Brianna Cerkiewicz <briannacerkiewicz@pop-os> # Add form_change_rank computed column to replace project_revision_rank | ||
computed_columns/project_revision_rank [computed_columns/[email protected]] 2023-05-01T22:38:14Z Brianna Cerkiewicz <briannacerkiewicz@pop-os> # Remove project_revision_rank | ||
tables/project_attachment [tables/project tables/attachment] 2023-04-25T22:08:32Z Sepehr Sobhani <[email protected]> # Join table to hold the relation between attachment and project table |
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,17 @@ | ||
-- Verify cif:tables/project_attachment on pg | ||
|
||
begin; | ||
|
||
select pg_catalog.has_table_privilege('cif.project_attachment', 'select'); | ||
|
||
-- cif_internal Grants | ||
select cif_private.verify_grant('select', 'project_attachment', 'cif_internal'); | ||
select cif_private.verify_grant('insert', 'project_attachment', 'cif_internal'); | ||
select cif_private.verify_grant('update', 'project_attachment', 'cif_internal'); | ||
|
||
-- cif_admin Grants | ||
select cif_private.verify_grant('select', 'project_attachment', 'cif_admin'); | ||
select cif_private.verify_grant('insert', 'project_attachment', 'cif_admin'); | ||
select cif_private.verify_grant('update', 'project_attachment', 'cif_admin'); | ||
|
||
rollback; |