diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-01-30 10:14:19 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-01-30 10:14:19 +0000 |
| commit | 2222597278620f07becf5707954874f5b3b0aaa5 (patch) | |
| tree | 624b2b9c0a61138d6530a007e9d467bef82e56df /db | |
| parent | b18ec88c2ade59649fed5bae873252183051b48d (diff) | |
introduce StudygroupInvitation model and use it as relation for course and user and cleanup the orphaned studygroup invitations, fixes #5195
Closes #5195
Merge request studip/studip!3879
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations/5.3.28_cleanup_studygroup_invitations.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrations/5.3.28_cleanup_studygroup_invitations.php b/db/migrations/5.3.28_cleanup_studygroup_invitations.php new file mode 100644 index 0000000..9c67224 --- /dev/null +++ b/db/migrations/5.3.28_cleanup_studygroup_invitations.php @@ -0,0 +1,18 @@ +<?php +return new class extends Migration { + public function description() + { + return 'Removes orphaned entries in table "studygroup_invitations"'; + } + + protected function up() + { + $query = "DELETE FROM `studygroup_invitations` + WHERE `user_id` NOT IN ( + SELECT `user_id` FROM `auth_user_md5` + ) OR `sem_id` NOT IN ( + SELECT `Seminar_id` FROM `seminare` + )"; + DBManager::get()->exec($query); + } +}; |
