From 96ef184c2a45d313c56f83e25cc2c5e1f9071d0f Mon Sep 17 00:00:00 2001 From: thiloho <123883702+thiloho@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:53:21 +0200 Subject: [PATCH] Exclude last modified columns from changelog triggering --- rest-api/db/migrations/20240911070907_change_log.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rest-api/db/migrations/20240911070907_change_log.sql b/rest-api/db/migrations/20240911070907_change_log.sql index 933e2ac..d4fe544 100644 --- a/rest-api/db/migrations/20240911070907_change_log.sql +++ b/rest-api/db/migrations/20240911070907_change_log.sql @@ -19,6 +19,9 @@ DECLARE _website_id UUID; BEGIN IF TG_TABLE_NAME = 'website' THEN + IF (to_jsonb (OLD.*) - 'last_modified_at') = (to_jsonb (NEW.*) - 'last_modified_at') OR (to_jsonb (OLD.*) - 'last_modified_by') = (to_jsonb (NEW.*) - 'last_modified_by') THEN + RETURN NEW; + END IF; _website_id := NEW.id; ELSE _website_id := COALESCE(NEW.website_id, OLD.website_id);