mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-10 06:54:12 +00:00
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:
parent
f080400826
commit
42a6d8ab0f
3 changed files with 15 additions and 1 deletions
|
@ -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;
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
SELECT
|
||||||
|
;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue