From 41512382749f1312dba3bdbc6b2c72188fcfd06c Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Mon, 28 Mar 2022 12:56:44 +0000
Subject: [PATCH] change column type of admission_seminar_uer.comment and
 seminar_user.comment, fixes #830

---
 ....1.26_change_seminar_user_comment_type.php | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 db/migrations/5.1.26_change_seminar_user_comment_type.php

diff --git a/db/migrations/5.1.26_change_seminar_user_comment_type.php b/db/migrations/5.1.26_change_seminar_user_comment_type.php
new file mode 100644
index 00000000000..03a0f74f942
--- /dev/null
+++ b/db/migrations/5.1.26_change_seminar_user_comment_type.php
@@ -0,0 +1,30 @@
+<?php
+final class ChangeSeminarUserCommentType extends Migration
+{
+    public function description()
+    {
+        return 'Changes the type of the comment column of tables seminar_user '
+             . 'and admission_seminar_user to VARCHAR(255) instead of TINYTEXT';
+    }
+
+    protected function up()
+    {
+        $query = "ALTER TABLE `admission_seminar_user`
+                  MODIFY COLUMN `comment` VARCHAR(255) NOT NULL DEFAULT ''";
+        DBManager::get()->exec($query);
+
+        $query = "ALTER TABLE `seminar_user`
+                  MODIFY COLUMN `comment` VARCHAR(255) NOT NULL DEFAULT ''";
+        DBManager::get()->exec($query);
+    }
+
+    protected function down()
+    {
+        // Column seminar_user does not need to be changed since it's already
+        // VARCHAR(255) in db/studip.sql
+
+        $query = "ALTER TABLE `admission_seminar_user`
+                  MODIFY COLUMN `comment` TINYTEXT";
+        DBManager::get()->exec($query);
+    }
+}
-- 
GitLab