diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-03-08 13:51:05 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-03-08 13:51:05 +0000 |
| commit | ef31c54962aa05fc70986f545e2968e83fe3df8a (patch) | |
| tree | 1c72115193b6802725f6c2d9e255d17527b9a071 /db | |
| parent | 2f063e32f03db806980c9a3ccab52fe637c070bf (diff) | |
remove forum abos and favorites upon user deletion and add a migration that cleans up the current state in the tables, fixes #2289
Closes #2289
Merge request studip/studip!1513
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations/5.1.43_cleanup_forum_tables.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrations/5.1.43_cleanup_forum_tables.php b/db/migrations/5.1.43_cleanup_forum_tables.php new file mode 100644 index 0000000..6f07469 --- /dev/null +++ b/db/migrations/5.1.43_cleanup_forum_tables.php @@ -0,0 +1,20 @@ +<?php +final class CleanupForumTables extends Migration +{ + protected function up() + { + $query = "DELETE FROM `forum_abo_users` + WHERE `user_id` NOT IN ( + SELECT `user_id` + FROM `auth_user_md5` + )"; + DBManager::get()->exec($query); + + $query = "DELETE FROM `forum_favorites` + WHERE `user_id` NOT IN ( + SELECT `user_id` + FROM `auth_user_md5` + )"; + DBManager::get()->exec($query); + } +} |
