-
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: adding funding_parameters table
- Loading branch information
1 parent
136620e
commit ba5f47c
Showing
4 changed files
with
70 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,44 @@ | ||
-- Deploy cif:tables/funding_parameters to pg | ||
|
||
begin; | ||
|
||
create table cif.funding_parameters( | ||
id integer primary key generated always as identity, | ||
project_id integer references cif.project(id) not null, | ||
total_project_value numeric(10,2), | ||
max_funding_amount numeric(10,2), | ||
provence_share_percentage decimal(2,2), | ||
holdback_percentage decimal(2,2), | ||
anticipated_funding_amount numeric(10,2) | ||
); | ||
|
||
do | ||
$grant$ | ||
begin | ||
|
||
-- Grant cif_internal permissions | ||
perform cif_private.grant_permissions('select', 'funding_parameters', 'cif_internal'); | ||
perform cif_private.grant_permissions('insert', 'funding_parameters', 'cif_internal'); | ||
perform cif_private.grant_permissions('update', 'funding_parameters', 'cif_internal'); | ||
|
||
-- Grant cif_admin permissions | ||
perform cif_private.grant_permissions('select', 'funding_parameters', 'cif_admin'); | ||
perform cif_private.grant_permissions('insert', 'funding_parameters', 'cif_admin'); | ||
perform cif_private.grant_permissions('update', 'funding_parameters', 'cif_admin'); | ||
|
||
-- Grant cif_external no permissions | ||
-- Grant cif_guest no permissions | ||
|
||
end | ||
$grant$; | ||
|
||
comment on table cif.funding_parameters is 'Table containing budget related data'; | ||
comment on column cif.funding_parameters.id is 'Unique ID for the budget data'; | ||
comment on column cif.funding_parameters.project_id is 'The related project for this data'; | ||
comment on column cif.funding_parameters.total_project_value is 'Total project value'; | ||
comment on column cif.funding_parameters.max_funding_amount is 'Maximum funding amount for this project'; | ||
comment on column cif.funding_parameters.provence_share_percentage is 'Provences share percentage'; | ||
comment on column cif.funding_parameters.holdback_percentage is 'Provence holds back this percentage of funding'; | ||
comment on column cif.funding_parameters.anticipated_funding_amount is 'The anticipated funding amount'; | ||
|
||
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,8 @@ | ||
-- Revert cif:tables/funding_parameters from pg | ||
|
||
|
||
begin; | ||
|
||
drop table cif.funding_parameters; | ||
|
||
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 |
---|---|---|
|
@@ -87,3 +87,4 @@ tables/emission_intensity_report [tables/reporting_requirement] 2022-06-22T20:29 | |
tables/milestone_report [tables/reporting_requirement] 2022-06-22T21:01:22Z Dylan Leard <[email protected]> # Table containing data for milestone reports | ||
mutations/add_milestone_to_revision [tables/reporting_requirement tables/form_change] 2022-06-23T23:26:45Z Dylan Leard <[email protected]> # A custom mutation chain to create form_change records for multiple tables when creating a milestone | ||
mutations/discard_milestone_form_change [tables/form_change tables/project_revision] 2022-06-24T16:25:29Z Dylan Leard <[email protected]> # Custom mutation to discard a set of form_change records relating to a milestone_report | ||
tables/funding_parameters 2022-06-23T17:34:25Z Gurjeet Matharu <[email protected]> # funding paramater 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/funding_parameters on pg | ||
|
||
begin; | ||
|
||
select pg_catalog.has_table_privilege('cif.operator', 'select'); | ||
|
||
-- cif_internal Grants | ||
select cif_private.verify_grant('select', 'funding_parameters', 'cif_internal'); | ||
select cif_private.verify_grant('insert', 'funding_parameters', 'cif_internal'); | ||
select cif_private.verify_grant('update', 'funding_parameters', 'cif_internal'); | ||
|
||
-- cif_admin Grants | ||
select cif_private.verify_grant('select', 'funding_parameters', 'cif_admin'); | ||
select cif_private.verify_grant('insert', 'funding_parameters', 'cif_admin'); | ||
select cif_private.verify_grant('update', 'funding_parameters', 'cif_admin'); | ||
|
||
rollback; |