diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-11-03 12:34:39 +0100 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-11-03 12:34:39 +0100 |
| commit | 1b834cacadf469b50afdba197b7fec502e1fd93d (patch) | |
| tree | f2aa337786d9dc4596fdafe987a2ea8f0e35fbb3 /db | |
| parent | 599d79f0424dcf66b95a54ae958191037b60ffdb (diff) | |
prevent fatal error when booking user is missing, fixes #6012
Closes #6012
Merge request studip/studip!4588
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations/5.4.21_cleanup_consultation_bookings.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrations/5.4.21_cleanup_consultation_bookings.php b/db/migrations/5.4.21_cleanup_consultation_bookings.php new file mode 100644 index 0000000..3c7d9f7 --- /dev/null +++ b/db/migrations/5.4.21_cleanup_consultation_bookings.php @@ -0,0 +1,17 @@ +<?php +final class CleanupConsultationBookings extends Migration +{ + public function description() + { + return 'Removes orphaned entries from consultation_bookings'; + } + + protected function up() + { + $query = "DELETE `consultation_bookings` + FROM `consultation_bookings` + LEFT JOIN `auth_user_md5` USING (`user_id`) + WHERE `auth_user_md5`.`user_id` IS NULL"; + DBManager::get()->exec($query); + } +} |
