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-31 11:51:48 +0100 |
| commit | f5d5e5d407dd23d4bc8b11d980038794aa05a31d (patch) | |
| tree | 80535db9ab48f4dd09cdfc00788eb001dba89b3a /db/migrations | |
| parent | 4eddbbdd3cd90ef6f82f3d51ff34b14da3747e51 (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/migrations')
| -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); + } +}; |
