From 27b722116b6e60d16a0fa4a9bd47ff2ac8487f08 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+github@gmail.com>
Date: Tue, 30 Apr 2024 14:48:50 +0200
Subject: [PATCH] don't delete global thread or automatically generated
 threads, re #4097

---
 db/migrations/5.1.56_cleanup_blubber.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/db/migrations/5.1.56_cleanup_blubber.php b/db/migrations/5.1.56_cleanup_blubber.php
index 86348bcb0ba..b870d78740d 100644
--- a/db/migrations/5.1.56_cleanup_blubber.php
+++ b/db/migrations/5.1.56_cleanup_blubber.php
@@ -16,6 +16,8 @@ return new class extends Migration
                   LEFT JOIN `object_user_visits` AS ouv
                     ON (bt.`thread_id` = ouv.`object_id`)
                   WHERE bt.`external_contact` = 0
+                    AND bt.`thread_id` != 'global'
+                    AND bt.`user_id` != ''
                     AND bt.`user_id` NOT IN (
                         SELECT `user_id` FROM `auth_user_md5`
                     )";
-- 
GitLab