From 62ce03796ba8e43277ba3f5acbf55cfb76591416 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Mon, 11 Mar 2024 00:31:23 +0900 Subject: Add update_updated_at trigger to articles table. --- deploy/articles_update_updated_at.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 deploy/articles_update_updated_at.sql (limited to 'deploy/articles_update_updated_at.sql') diff --git a/deploy/articles_update_updated_at.sql b/deploy/articles_update_updated_at.sql new file mode 100644 index 0000000..31b7ccd --- /dev/null +++ b/deploy/articles_update_updated_at.sql @@ -0,0 +1,15 @@ +-- Deploy diary:articles_update_updated_at to pg +-- requires: schema +-- requires: articles +-- requires: update_updated_at + +BEGIN; + +SET search_path to diary; + +CREATE OR REPLACE TRIGGER update_updated_at + BEFORE UPDATE ON articles + FOR EACH ROW + EXECUTE FUNCTION update_updated_at(); + +COMMIT; -- cgit v1.2.3