Skip to content
Snippets Groups Projects
Commit df66ea02 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

remove course notifications as well when deleting user and cleanup table via migration, fixes #2141

Closes #2141

Merge request studip/studip!1389
parent 9c9a398d
No related branches found
No related tags found
No related merge requests found
<?php
/**
* @see https://gitlab.studip.de/studip/studip/-/issues/2141
*/
final class CleanupSeminarUserNotifications extends Migration
{
public function description()
{
return "Removes all entries from `seminar_user_notifications` that are not in `seminar_user` as well";
}
protected function up()
{
$query = "DELETE `seminar_user_notifications`
FROM `seminar_user_notifications`
LEFT JOIN `seminar_user` USING(`user_id`, `Seminar_id`)
WHERE `seminar_user`.`user_id` IS NULL";
DBManager::get()->exec($query);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment