-
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: computed column to retrive an operator's pending form change
- Loading branch information
Showing
6 changed files
with
48 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
16 changes: 16 additions & 0 deletions
16
schema/deploy/computed_columns/operator_pending_form_change.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 @@ | ||
-- Deploy cif:computed_columns/operator_pending_form_change to pg | ||
|
||
begin; | ||
|
||
create function cif.operator_pending_form_change(cif.operator) returns cif.form_change as $$ | ||
select * from cif.form_change | ||
where form_data_schema_name = 'cif' | ||
and form_data_table_name = 'operator' | ||
and form_data_record_id = $1.id | ||
and change_status = 'pending' | ||
and created_by = (select id from cif.cif_user where uuid = (select sub from cif.session())); | ||
$$ language sql stable; | ||
|
||
comment on function cif.operator_pending_form_change(cif.operator) is 'Returns the pending form change editing the operator created by the current user, if it exists.'; | ||
|
||
commit; |
7 changes: 7 additions & 0 deletions
7
schema/revert/computed_columns/operator_pending_form_change.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/operator_pending_form_change from pg | ||
|
||
begin; | ||
|
||
drop function cif.operator_pending_form_change(cif.operator); | ||
|
||
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 |
---|---|---|
|
@@ -58,3 +58,4 @@ computed_columns/project_revision_project_manager_form_change [tables/project_re | |
types/manager_form_changes_by_label_composite_return [schemas/main] 2022-02-18T20:58:37Z Dylan Leard <[email protected]> # Add custom composite return type for computed column project_revision_project_manager_form_changes_by_label | ||
computed_columns/project_revision_project_manager_form_changes_by_label [tables/project_revision tables/project_manager] 2022-02-18T21:32:45Z Dylan Leard <[email protected]> # Computed column to retrieve the set of form changes related to the project manager association by project_manager_label, within a project revision | ||
computed_columns/project_pending_project_revision 2022-02-16T17:14:03Z Matthieu Foucault <[email protected]> # add a computed column to return a pending revision for a project | ||
computed_columns/operator_pending_form_change 2022-02-16T21:48:38Z Pierre Bastianelli <[email protected]> # A computed column returning a potential existing form change for an operator, scoped by the current user |
7 changes: 7 additions & 0 deletions
7
schema/verify/computed_columns/operator_pending_form_change.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/operator_pending_form_change on pg | ||
|
||
BEGIN; | ||
|
||
-- XXX Add verifications here. | ||
|
||
ROLLBACK; |