From 97a436677f0684f093564db48a85019c4ef52548 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Tue, 9 Jun 2026 23:30:15 +0000 Subject: [PATCH] Fire biography_log_trigger after INSERT as well as update --- db/schemas/lib/triggers/create/biography_log.m4 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/db/schemas/lib/triggers/create/biography_log.m4 b/db/schemas/lib/triggers/create/biography_log.m4 index 1596c5d..cbcb232 100644 --- a/db/schemas/lib/triggers/create/biography_log.m4 +++ b/db/schemas/lib/triggers/create/biography_log.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2015 The Meme Factory, Inc. http://www.karlpinc.com/ +dnl Copyright (C) 2025, 2026 The Meme Factory, Inc. http://www.karlpinc.com/ dnl dnl This program is free software: you can redistribute it and/or modify it dnl under the terms of the GNU Affero General Public License as published by @@ -30,13 +30,15 @@ CREATE OR REPLACE FUNCTION biography_log_func () sdb_function_set_search_path AS $$ BEGIN - -- Function for biography_log update trigger + -- Function for biography_log insert and update triggers -- - -- AGPL_notice(` --', `2025', + -- AGPL_notice(` --', `2025, 2026', `The Meme Factory, Inc., www.karlpinc.com') - -- Allowing the BLID to change makes life too complicated. - cannot_change(`BIOGRAPHY_LOG', `BLID') + IF TG_OP = 'UPDATE' THEN + -- Allowing the BLID to change makes life too complicated. + cannot_change(`BIOGRAPHY_LOG', `BLID') + END IF; RETURN NULL; END; @@ -45,6 +47,6 @@ $$; RAISE INFO 'biography_log_trigger'; CREATE TRIGGER biography_log_trigger - AFTER UPDATE + AFTER INSERT OR UPDATE ON biography_log FOR EACH ROW EXECUTE PROCEDURE biography_log_func(); -- 2.34.1