From 3dbf91d2b27f156ef9ae31a737ca494c3ac505a5 Mon Sep 17 00:00:00 2001 From: Thomas Hackl Date: Wed, 24 Jan 2024 09:22:00 +0000 Subject: Resolve "Falsche Migrationsnummer, Migration ignoriert das Tabellenschema" Closes #3669 Merge request studip/studip!2542 --- db/migrations/5.1.53_cleanup_cw_tasks.php | 23 ++++++++++++++++++++++ db/migrations/5.5.14_cleanup_cw_tasks.php | 23 ---------------------- .../5.5.14_cleanup_cw_tasks_placeholder.php | 17 ++++++++++++++++ lib/classes/UserManagement.class.php | 2 +- 4 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 db/migrations/5.1.53_cleanup_cw_tasks.php delete mode 100644 db/migrations/5.5.14_cleanup_cw_tasks.php create mode 100644 db/migrations/5.5.14_cleanup_cw_tasks_placeholder.php diff --git a/db/migrations/5.1.53_cleanup_cw_tasks.php b/db/migrations/5.1.53_cleanup_cw_tasks.php new file mode 100644 index 0000000..8df653d --- /dev/null +++ b/db/migrations/5.1.53_cleanup_cw_tasks.php @@ -0,0 +1,23 @@ +exec(' + DELETE FROM `cw_tasks` + WHERE `solver_type` = "autor" + AND `solver_id` NOT IN (SELECT `user_id` FROM `auth_user_md5`)' + ); + DBManager::get()->exec(' + DELETE FROM `cw_tasks` + WHERE `solver_type` = "group" + AND `solver_id` NOT IN (SELECT `statusgruppe_id` FROM `statusgruppen`)' + ); + } +} diff --git a/db/migrations/5.5.14_cleanup_cw_tasks.php b/db/migrations/5.5.14_cleanup_cw_tasks.php deleted file mode 100644 index 94ab019..0000000 --- a/db/migrations/5.5.14_cleanup_cw_tasks.php +++ /dev/null @@ -1,23 +0,0 @@ -exec(' - DELETE FROM `cw_tasks` - WHERE `solver_type` = "user" - AND `solver_id` NOT IN (SELECT `user_id` FROM `auth_user_md5`)' - ); - DBManager::get()->exec(' - DELETE FROM `cw_tasks` - WHERE `solver_type` = "group" - AND `solver_id` NOT IN (SELECT `statusgruppe_id` FROM `statusgruppen`)' - ); - } -} diff --git a/db/migrations/5.5.14_cleanup_cw_tasks_placeholder.php b/db/migrations/5.5.14_cleanup_cw_tasks_placeholder.php new file mode 100644 index 0000000..cba0d26 --- /dev/null +++ b/db/migrations/5.5.14_cleanup_cw_tasks_placeholder.php @@ -0,0 +1,17 @@ + see 5.1.53'; + } +} diff --git a/lib/classes/UserManagement.class.php b/lib/classes/UserManagement.class.php index 620672c..1a49aed 100644 --- a/lib/classes/UserManagement.class.php +++ b/lib/classes/UserManagement.class.php @@ -990,7 +990,7 @@ class UserManagement \Courseware\UserProgress::deleteBySQL('user_id = ?', [$this->user_data['auth_user_md5.user_id']]); \Courseware\Bookmark::deleteBySQL('user_id = ?', [$this->user_data['auth_user_md5.user_id']]); \Courseware\Task::deleteBySQL( - '`solver_id` = ? AND `solver_type`= "user"', + '`solver_id` = ? AND `solver_type`= "autor"', [$this->user_data['auth_user_md5.user_id']] ); // delete courseware elements in courses of this user -- cgit v1.0