diff options
Diffstat (limited to 'db/migrations/5.4.21_cleanup_consultation_bookings.php')
| -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); + } +} |
