Skip to content

Commit 9410c80

Browse files
committed
Auto merge of #3993 - Turbo87:simplify-trigger, r=locks
database: Simplify `trigger_versions_set_updated_at` trigger on the `versions` table The only mutable columns in this table are `yanked` and `downloads`, but the trigger should specifically not be used when the `downloads` column changes. That means we're only left with the `yanked` column and can be more specific in the trigger condition. This unblocks #3992, but also generally simplifies the table trigger.
2 parents 9a28438 + 9dcf3c7 commit 9410c80

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- remove the new trigger
2+
DROP TRIGGER trigger_versions_set_updated_at ON versions;
3+
4+
-- add the old trigger again
5+
CREATE TRIGGER trigger_versions_set_updated_at
6+
BEFORE UPDATE
7+
ON versions
8+
FOR EACH ROW
9+
EXECUTE PROCEDURE set_updated_at_ignore_downloads();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- remove the old trigger
2+
DROP TRIGGER trigger_versions_set_updated_at ON versions;
3+
4+
-- add the new trigger only for the `yanked` column
5+
CREATE TRIGGER trigger_versions_set_updated_at
6+
BEFORE UPDATE OF yanked
7+
ON versions
8+
FOR EACH ROW
9+
EXECUTE PROCEDURE set_updated_at();

0 commit comments

Comments
 (0)