From c5e71f87089004dd0c87c791ef8e43c269b4b2e4 Mon Sep 17 00:00:00 2001 From: Someone Date: Sun, 26 Nov 2023 00:36:42 +0100 Subject: [PATCH] maintenance/db.py --- maintenance/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintenance/db.py b/maintenance/db.py index d61c309..83cf561 100755 --- a/maintenance/db.py +++ b/maintenance/db.py @@ -456,7 +456,7 @@ print(f"* [{(time.time() - TS_START):08.5f}] {cur.rowcount} corrected joins 'as # TODO? Unknown use of said table -> wait for next thread release phase? # FIX: recalculate postcount to exclude deleted posts in threads table - migration issue of old threads. github: https://github.com/mattermost/mattermost-server/issues/16321 -cur.execute("""UPDATE threads SET replycount = a.cnt FROM (SELECT rootid, count(*) cnt, max(createat) ts FROM posts GROUP BY 1) AS a WHERE threads.postid = a.rootid AND replycount <> a.cnt RETURNING *""") +cur.execute("""UPDATE threads SET replycount = a.cnt FROM (SELECT rootid, count(*) cnt, max(createat) ts FROM posts WHERE deleteat = 0 or deleteat = NULL GROUP BY 1) AS a WHERE threads.postid = a.rootid AND replycount <> a.cnt RETURNING *""") print(f"* [{(time.time() - TS_START):08.5f}] {cur.rowcount} corrected threads replycount(s).") # remove "disable_group_highlight" prop from posts. -- 2.43.0