-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 16368-mui-x-pro
- Loading branch information
Showing
6 changed files
with
98 additions
and
20 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
28 changes: 28 additions & 0 deletions
28
...tions/1709335308607_alter_table_public_moped_proj_phases_alter_column_updated_at/down.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,28 @@ | ||
alter table moped_proj_components alter column updated_at drop default; | ||
alter table moped_proj_funding alter column created_at set default clock_timestamp(); | ||
alter table moped_proj_funding alter column updated_at drop default; | ||
alter table moped_proj_milestones alter column created_at set default clock_timestamp(); | ||
alter table moped_proj_milestones alter column updated_at drop default; | ||
alter table moped_proj_notes alter column created_at set default clock_timestamp(); | ||
alter table moped_proj_notes alter column updated_at drop default; | ||
alter table moped_proj_phases alter column created_at set default clock_timestamp(); | ||
alter table moped_proj_phases alter column updated_at drop default; | ||
alter table moped_proj_work_activity alter column updated_at drop default; | ||
|
||
CREATE OR REPLACE FUNCTION public.update_self_and_project_updated_audit_fields() | ||
RETURNS trigger | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
BEGIN | ||
-- Update the updated_at field in the current row of the triggering table | ||
NEW.updated_at := NOW(); | ||
|
||
-- Update the updated_at and updated_by_user_id fields in the related row of moped_project | ||
UPDATE moped_project | ||
SET updated_at = NEW.updated_at, | ||
updated_by_user_id = NEW.updated_by_user_id | ||
WHERE project_id = NEW.project_id; | ||
|
||
RETURN NEW; | ||
END; | ||
$function$; |
30 changes: 30 additions & 0 deletions
30
...rations/1709335308607_alter_table_public_moped_proj_phases_alter_column_updated_at/up.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,30 @@ | ||
alter table moped_proj_components alter column updated_at set default now(); | ||
alter table moped_proj_funding alter column created_at set default now(); | ||
alter table moped_proj_funding alter column updated_at set default now(); | ||
alter table moped_proj_milestones alter column created_at set default now(); | ||
alter table moped_proj_milestones alter column updated_at set default now(); | ||
alter table moped_proj_notes alter column created_at set default now(); | ||
alter table moped_proj_notes alter column updated_at set default now(); | ||
alter table moped_proj_phases alter column created_at set default now(); | ||
alter table moped_proj_phases alter column updated_at set default now(); | ||
alter table moped_proj_work_activity alter column updated_at set default now(); | ||
|
||
CREATE OR REPLACE FUNCTION public.update_self_and_project_updated_audit_fields() | ||
RETURNS trigger | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
BEGIN | ||
-- Update the updated_at field in the current row of the triggering table only on update | ||
IF (TG_OP = 'UPDATE') THEN | ||
NEW.updated_at := NOW(); | ||
END IF; | ||
|
||
-- Update the updated_at and updated_by_user_id fields in the related row of moped_project | ||
UPDATE moped_project | ||
SET updated_at = NEW.updated_at, | ||
updated_by_user_id = NEW.updated_by_user_id | ||
WHERE project_id = NEW.project_id; | ||
|
||
RETURN NEW; | ||
END; | ||
$function$; |
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
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