From 3dbf91d2b27f156ef9ae31a737ca494c3ac505a5 Mon Sep 17 00:00:00 2001 From: Thomas Hackl <hackl@data-quest.de> Date: Wed, 24 Jan 2024 09:22:00 +0000 Subject: [PATCH] Resolve "Falsche Migrationsnummer, Migration ignoriert das Tabellenschema" Closes #3669 Merge request studip/studip!2542 --- ...cw_tasks.php => 5.1.53_cleanup_cw_tasks.php} | 2 +- .../5.5.14_cleanup_cw_tasks_placeholder.php | 17 +++++++++++++++++ lib/classes/UserManagement.class.php | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) rename db/migrations/{5.5.14_cleanup_cw_tasks.php => 5.1.53_cleanup_cw_tasks.php} (92%) create mode 100644 db/migrations/5.5.14_cleanup_cw_tasks_placeholder.php diff --git a/db/migrations/5.5.14_cleanup_cw_tasks.php b/db/migrations/5.1.53_cleanup_cw_tasks.php similarity index 92% rename from db/migrations/5.5.14_cleanup_cw_tasks.php rename to db/migrations/5.1.53_cleanup_cw_tasks.php index 94ab0198946..8df653d5b53 100644 --- a/db/migrations/5.5.14_cleanup_cw_tasks.php +++ b/db/migrations/5.1.53_cleanup_cw_tasks.php @@ -11,7 +11,7 @@ final class CleanupCwTasks extends Migration { DBManager::get()->exec(' DELETE FROM `cw_tasks` - WHERE `solver_type` = "user" + WHERE `solver_type` = "autor" AND `solver_id` NOT IN (SELECT `user_id` FROM `auth_user_md5`)' ); DBManager::get()->exec(' 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 00000000000..cba0d26ebc4 --- /dev/null +++ b/db/migrations/5.5.14_cleanup_cw_tasks_placeholder.php @@ -0,0 +1,17 @@ +<?php +/** + * This migration only exists as a placeholder for the original + * migration 5.5.14 which has been renumbered to 5.1.53 as it was + * downported. + * As everything has already been done in 5.1.53, nothing happens here. + * + * @see https://gitlab.studip.de/studip/studip/-/issues/3669 + */ + +final class CleanupCwTasksPlaceholder extends Migration +{ + public function description() + { + return 'empty placeholder for former migration with wrong number -> see 5.1.53'; + } +} diff --git a/lib/classes/UserManagement.class.php b/lib/classes/UserManagement.class.php index 620672c641f..1a49aed3124 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 -- GitLab