diff options
| author | David Siegfried <david.siegfried@uni-vechta.de> | 2023-12-22 13:48:17 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2023-12-22 13:48:17 +0000 |
| commit | 13e5aa83173d27ee925c1e6a4fbc212f0a5618a5 (patch) | |
| tree | 7389f8e92356555d2957756244500b946d2f975a /db | |
| parent | 8ece0427660c3ed4850ad3cb3a51b59da63e4165 (diff) | |
prevent php-error and cleanup unlinked db-entries, closes #3592
Closes #3592
Merge request studip/studip!2485
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations/5.5.14_cleanup_cw_tasks.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/db/migrations/5.5.14_cleanup_cw_tasks.php b/db/migrations/5.5.14_cleanup_cw_tasks.php new file mode 100644 index 0000000..94ab019 --- /dev/null +++ b/db/migrations/5.5.14_cleanup_cw_tasks.php @@ -0,0 +1,23 @@ +<?php + +final class CleanupCwTasks extends Migration +{ + public function description() + { + return 'deletes unlinked entries'; + } + + public function up() + { + DBManager::get()->exec(' + DELETE FROM `cw_tasks` + WHERE `solver_type` = "user" + AND `solver_id` NOT IN (SELECT `user_id` FROM `auth_user_md5`)' + ); + DBManager::get()->exec(' + DELETE FROM `cw_tasks` + WHERE `solver_type` = "group" + AND `solver_id` NOT IN (SELECT `statusgruppe_id` FROM `statusgruppen`)' + ); + } +} |
