From ac13b54d343768476bd7b2df6d96c56c0dbb37a1 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Wed, 11 Sep 2024 18:23:56 +0545 Subject: [PATCH] fix: config change update trigger --- views/030_config_changes.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/views/030_config_changes.sql b/views/030_config_changes.sql index 4926c60f..562837b7 100644 --- a/views/030_config_changes.sql +++ b/views/030_config_changes.sql @@ -10,11 +10,11 @@ BEGIN SET change_type = NEW.change_type, count = CASE - WHEN NEW.details IS DISTINCT FROM OLD.details THEN NEW.count + WHEN NEW.details IS DISTINCT FROM OLD.details OR NEW.diff IS DISTINCT FROM OLD.diff THEN NEW.count ELSE count END, created_at = CASE - WHEN NEW.details IS DISTINCT FROM OLD.details THEN NOW() + WHEN NEW.details IS DISTINCT FROM OLD.details OR NEW.diff IS DISTINCT FROM OLD.diff THEN NOW() ELSE COALESCE(NEW.created_at, OLD.created_at) END, created_by = NEW.created_by, @@ -39,11 +39,11 @@ EXCEPTION SET change_type = NEW.change_type, count = CASE - WHEN NEW.details IS DISTINCT FROM OLD.details THEN config_changes.count + count_increment + WHEN NEW.details IS DISTINCT FROM OLD.details OR NEW.diff IS DISTINCT FROM OLD.diff THEN config_changes.count + count_increment ELSE count END, created_at = CASE - WHEN NEW.details IS DISTINCT FROM OLD.details THEN NOW() + WHEN NEW.details IS DISTINCT FROM OLD.details OR NEW.diff IS DISTINCT FROM OLD.diff THEN NOW() ELSE COALESCE(NEW.created_at, OLD.created_at) END, created_by = NEW.created_by,