Skip to content

Commit

Permalink
fix: config change update trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe authored and moshloop committed Sep 11, 2024
1 parent 19e65f8 commit ac13b54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions views/030_config_changes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit ac13b54

Please sign in to comment.