From d7f08e2a280436cb89e83575f10e0adb52a9c53e Mon Sep 17 00:00:00 2001
From: Masaya Tojo <masaya@tojo.tokyo>
Date: Wed, 30 Aug 2023 01:00:17 +0900
Subject: Add update_timestamp trigger to diaries table

---
 deploy/diaries_update_timestamp.sql | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 deploy/diaries_update_timestamp.sql

(limited to 'deploy/diaries_update_timestamp.sql')

diff --git a/deploy/diaries_update_timestamp.sql b/deploy/diaries_update_timestamp.sql
new file mode 100644
index 0000000..c11104f
--- /dev/null
+++ b/deploy/diaries_update_timestamp.sql
@@ -0,0 +1,15 @@
+-- Deploy photos:diaries_update_timestamp to pg
+-- requires: schema
+-- requires: diaries
+-- requires: update_timestamp
+
+BEGIN;
+
+SET search_path to photos;
+
+CREATE OR REPLACE TRIGGER update_timestamp
+  BEFORE UPDATE ON diaries
+  FOR EACH ROW
+  EXECUTE FUNCTION update_timestamp();
+
+COMMIT;
-- 
cgit v1.2.3

