-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Updated_At column to Merge Requests
This will enable us to see when the status of a merge request last changed.
- Loading branch information
1 parent
7c9ae5f
commit 882d131
Showing
4 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
deployment/hasura/migrations/AerieMerlin/36_metadata_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,5 @@ | ||
drop trigger set_timestamp on merge_request; | ||
drop function merge_request_set_updated_at(); | ||
alter table merge_request drop column updated_at; | ||
|
||
call migrations.mark_migration_rolled_back('36'); |
17 changes: 17 additions & 0 deletions
17
deployment/hasura/migrations/AerieMerlin/36_metadata_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,17 @@ | ||
alter table merge_request add column updated_at timestamptz not null default now(); | ||
|
||
create function merge_request_set_updated_at() | ||
returns trigger | ||
security definer | ||
language plpgsql as $$begin | ||
new.updated_at = now(); | ||
return new; | ||
end$$; | ||
|
||
create trigger set_timestamp | ||
before update or insert on merge_request | ||
for each row | ||
execute function merge_request_set_updated_at(); | ||
|
||
call migrations.mark_migration_applied('36'); | ||
|
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