1
0
Fork 0
mirror of https://github.com/LemmyNet/lemmy.git synced 2025-04-21 10:24:06 +00:00

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

* Fix not-equals check in post aggregates update trigger

Should fix 

* 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
crates/db_schema/replaceable_schema
migrations/2024-06-17-160323_fix_post_aggregates_featured_local

View file

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

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;