Skip to content

Commit

Permalink
Fix not-equals check in post aggregates update trigger (#4837)
Browse files Browse the repository at this point in the history
* Fix not-equals check in post aggregates update trigger

Should fix #4836

* Create up.sql

* Create down.sql

* Update down.sql
  • Loading branch information
dullbananas committed Jun 17, 2024
1 parent f080400 commit 42a6d8a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/db_schema/replaceable_schema/triggers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ BEGIN
INNER JOIN old_post ON old_post.id = new_post.id
AND (old_post.featured_community,
old_post.featured_local) != (new_post.featured_community,
old_post.featured_local)
new_post.featured_local)
WHERE
post_aggregates.post_id = new_post.id;
RETURN NULL;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SELECT
;

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Fix rows that were not updated because of the old incorrect trigger
UPDATE
post_aggregates
SET
featured_local = post.featured_local
FROM
post
WHERE
post.id = post_aggregates.post_id
AND post.featured_local != post_aggregates.featured_local;

0 comments on commit 42a6d8a

Please sign in to comment.