-
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.
chore: reporting requirement has expenses computed column
- Loading branch information
Showing
6 changed files
with
160 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
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
26 changes: 26 additions & 0 deletions
26
schema/deploy/computed_columns/reporting_requirement_has_expenses.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,26 @@ | ||
-- Deploy cif:computed_columns/reporting_requirement_has_expenses to pg | ||
-- requires: tables/report_type | ||
-- requires: tables/reporting_requirement | ||
|
||
begin; | ||
|
||
create function cif.reporting_requirement_has_expenses(cif.reporting_requirement) | ||
returns boolean as | ||
$computed_column$ | ||
select has_expenses | ||
from cif.report_type | ||
where name = $1.report_type; | ||
$computed_column$ language sql stable; | ||
|
||
comment on function cif.reporting_requirement_has_expenses(cif.reporting_requirement) is | ||
'Returns the value of the has_expenses column for the report_type of the given reporting_requirement'; | ||
|
||
commit; | ||
|
||
-- create function cif.reporting_requirement_has_expenses(cif.reporting_requirement) | ||
-- returns boolean as | ||
-- $computed_column$ | ||
-- select has_expenses | ||
-- from cif.report_type | ||
-- where name = $1.report_type; | ||
-- $computed_column$ language sql stable; |
7 changes: 7 additions & 0 deletions
7
schema/revert/computed_columns/reporting_requirement_has_expenses.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,7 @@ | ||
-- Revert cif:computed_columns/reporting_requirement_has_expenses from pg | ||
|
||
begin; | ||
|
||
drop function cif.reporting_requirement_has_expenses; | ||
|
||
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
7 changes: 7 additions & 0 deletions
7
schema/verify/computed_columns/reporting_requirement_has_expenses.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,7 @@ | ||
-- Verify cif:computed_columns/reporting_requirement_has_expenses on pg | ||
|
||
BEGIN; | ||
|
||
select pg_get_functiondef('cif.reporting_requirement_has_expenses(cif.reporting_requirement)'::regprocedure); | ||
|
||
ROLLBACK; |