-
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: linked new project status to funding stream
- Loading branch information
1 parent
f10a437
commit 5e02a15
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
schema/deploy/funding_stream_project_status_001_update_hardcoded_values.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,14 @@ | ||
-- Deploy cif:funding_stream_project_status_001_update_hardcoded_values to pg | ||
-- requires: tables/project_status | ||
-- requires: tables/funding_stream | ||
|
||
begin; | ||
|
||
update cif.funding_stream_project_status set sorting_order = 20 where project_status_id = (select id from cif.project_status where name = 'Agreement Terminated'); | ||
update cif.funding_stream_project_status set sorting_order = 21 where project_status_id = (select id from cif.project_status where name = 'Closed'); | ||
|
||
insert into cif.funding_stream_project_status (funding_stream_id, project_status_id, sorting_order) | ||
values | ||
((select id from cif.funding_stream where name = 'EP'), (select id from cif.project_status where name = 'Emissions Intensity Report Submission'), 15); | ||
|
||
commit; |
10 changes: 10 additions & 0 deletions
10
schema/revert/funding_stream_project_status_001_update_hardcoded_values.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,10 @@ | ||
-- Revert cif:funding_stream_project_status_001_update_hardcoded_values from pg | ||
|
||
begin; | ||
|
||
delete from cif.funding_stream_project_status where project_status_id = (select id from cif.project_status where name = 'Emissions Intensity Report Submission'); | ||
|
||
update cif.funding_stream_project_status set sorting_order = 15 where project_status_id = (select id from cif.project_status where name = 'Agreement Terminated'); | ||
update cif.funding_stream_project_status set sorting_order = 16 where project_status_id = (select id from cif.project_status where name = 'Closed'); | ||
|
||
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 |
---|---|---|
|
@@ -320,3 +320,4 @@ migrations/007_create_form_changes_for_existing_project_attachments [tables/form | |
tables/project_type_002 2023-06-30T17:42:14Z Sam Warren <[email protected]> # add Energy Efficiency to list of project types | ||
tables/sector_001 2023-06-30T17:44:24Z Sam Warren <[email protected]> # add Waste and Manufacturing to sectors list | ||
tables/project_status_002_update_hardcoded_values 2023-07-05T16:29:30Z Josh Larouche <[email protected]> # adding a project status value and renaming one other value | ||
funding_stream_project_status_001_update_hardcoded_values 2023-07-05T20:37:10Z Josh Larouche <[email protected]> # linking new status to a funding stream |
16 changes: 16 additions & 0 deletions
16
schema/verify/funding_stream_project_status_001_update_hardcoded_values.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,16 @@ | ||
-- Verify cif:funding_stream_project_status_001_update_hardcoded_values on pg | ||
|
||
begin; | ||
|
||
do $$ | ||
begin | ||
-- check all new values are present | ||
assert ( | ||
select 1 = (select count(funding_stream_id) | ||
from cif.funding_stream_project_status | ||
where project_status_id = (select id from cif.project_status where name = 'Emissions Intensity Report Submission')) | ||
); | ||
end; | ||
$$; | ||
|
||
rollback; |