Fix not-equals check in post aggregates update trigger (#4837)

* Fix not-equals check in post aggregates update trigger

Should fix #4836

* Create up.sql

* Create down.sql

* Update down.sql
This commit is contained in:
dullbananas 2024-06-17 12:25:54 -07:00 committed by GitHub
parent f080400826
commit 42a6d8ab0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View file

@ -486,7 +486,7 @@ BEGIN
INNER JOIN old_post ON old_post.id = new_post.id INNER JOIN old_post ON old_post.id = new_post.id
AND (old_post.featured_community, AND (old_post.featured_community,
old_post.featured_local) != (new_post.featured_community, old_post.featured_local) != (new_post.featured_community,
old_post.featured_local) new_post.featured_local)
WHERE WHERE
post_aggregates.post_id = new_post.id; post_aggregates.post_id = new_post.id;
RETURN NULL; RETURN NULL;

View file

@ -0,0 +1,3 @@
SELECT
;

View file

@ -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;