Skip to content

Commit

Permalink
feat: linked new project status to funding stream
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLarouche committed Jul 7, 2023
1 parent f10a437 commit 5e02a15
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
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;
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;
1 change: 1 addition & 0 deletions schema/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -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
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;

0 comments on commit 5e02a15

Please sign in to comment.