From 43df0bbc55deb807cd780517797f2a3772553929 Mon Sep 17 00:00:00 2001 From: Moritz Strohm Date: Tue, 3 Dec 2024 15:55:26 +0000 Subject: migration 6.0.35: use a generic way to check if a column exists, fixes #4954 Closes #4954 Merge request studip/studip!3714 --- db/migrations/6.0.35_new_schedule_improvements.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/db/migrations/6.0.35_new_schedule_improvements.php b/db/migrations/6.0.35_new_schedule_improvements.php index 2a038b9..f97292e 100644 --- a/db/migrations/6.0.35_new_schedule_improvements.php +++ b/db/migrations/6.0.35_new_schedule_improvements.php @@ -3,6 +3,8 @@ class NewScheduleImprovements extends Migration { + use DatabaseMigrationTrait; + public function description() { return 'A bugfix migration to add colours to personal schedule entries again and to migrate schedule configurations.'; @@ -11,10 +13,12 @@ class NewScheduleImprovements extends Migration protected function up() { $db = DBManager::get(); - $db->exec( - "ALTER TABLE `schedule_entries` - ADD COLUMN IF NOT EXISTS `colour_id` TINYINT(3) NOT NULL DEFAULT 0" - ); + if (!$this->columnExists('schedule_entries', 'colour_id')) { + $db->exec( + "ALTER TABLE `schedule_entries` + ADD COLUMN `colour_id` TINYINT(3) NOT NULL DEFAULT 0" + ); + } //Migrate the content of schedule configuration entries: -- cgit v1.0