This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
forked from eesast/hasura
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
migrations/1715945631359_alter_table_public_course_comment_add_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,21 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "public"."course_comment" add column "updated_at" timestamptz | ||
-- null default now(); | ||
-- | ||
-- CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"() | ||
-- RETURNS TRIGGER AS $$ | ||
-- DECLARE | ||
-- _new record; | ||
-- BEGIN | ||
-- _new := NEW; | ||
-- _new."updated_at" = NOW(); | ||
-- RETURN _new; | ||
-- END; | ||
-- $$ LANGUAGE plpgsql; | ||
-- CREATE TRIGGER "set_public_course_comment_updated_at" | ||
-- BEFORE UPDATE ON "public"."course_comment" | ||
-- FOR EACH ROW | ||
-- EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); | ||
-- COMMENT ON TRIGGER "set_public_course_comment_updated_at" ON "public"."course_comment" | ||
-- IS 'trigger to set value of column "updated_at" to current timestamp on row update'; |
19 changes: 19 additions & 0 deletions
19
migrations/1715945631359_alter_table_public_course_comment_add_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,19 @@ | ||
alter table "public"."course_comment" add column "updated_at" timestamptz | ||
null default now(); | ||
|
||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"() | ||
RETURNS TRIGGER AS $$ | ||
DECLARE | ||
_new record; | ||
BEGIN | ||
_new := NEW; | ||
_new."updated_at" = NOW(); | ||
RETURN _new; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
CREATE TRIGGER "set_public_course_comment_updated_at" | ||
BEFORE UPDATE ON "public"."course_comment" | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); | ||
COMMENT ON TRIGGER "set_public_course_comment_updated_at" ON "public"."course_comment" | ||
IS 'trigger to set value of column "updated_at" to current timestamp on row update'; |