From f9e96015f696aa9c576075dd67ae4dfe774c5ebb Mon Sep 17 00:00:00 2001 From: Someone Date: Fri, 22 Nov 2024 23:01:33 +0100 Subject: [PATCH] maintenance/db.py --- maintenance/db.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/maintenance/db.py b/maintenance/db.py index af22f48..7d5c380 100755 --- a/maintenance/db.py +++ b/maintenance/db.py @@ -15,7 +15,7 @@ import psycopg2.extras import config print("Mattermost DB cleanup script: https://git.somenet.org/pub/jan/mattermost-privileged.git") -print("Tested on 9.11\n") +print("Tested on 10.2\n") dbconn = psycopg2.connect(config.dbconnstring) dbconn.set_session(autocommit=False) @@ -459,6 +459,10 @@ print(f"* [{(time.time() - TS_START):08.5f}] {cur.rowcount} corrected joins 'as 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).") +# Change limit of 15 to 400 direct message channels. +cur.execute("""UPDATE preferences SET value='400' WHERE category='sidebar_settings' AND name='limit_visible_dms_gms' AND value='15' RETURNING *""") +print(f"* [{(time.time() - TS_START):08.5f}] {cur.rowcount} user's dm sidebar limit set to 400.") + # remove "disable_group_highlight" prop from posts. cur.execute("""UPDATE posts SET props = props::jsonb - 'disable_group_highlight' WHERE props::jsonb ? 'disable_group_highlight' RETURNING *""") print(f"* [{(time.time() - TS_START):08.5f}] {cur.rowcount} removed 'disable_group_highlight' prop from post(s).") -- 2.43.0