From c0afe3fbd09bf4de8c2752cf5eb3dc2085593fcb Mon Sep 17 00:00:00 2001
From: Rasmus Fuhse <fuhse@data-quest.de>
Date: Wed, 9 Feb 2022 09:03:46 +0000
Subject: [PATCH] Resolve "OER Campus: Data too long for column 'content_type'"

---
 .../1.328_resize_oer_content_type_length.php  | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100755 db/migrations/1.328_resize_oer_content_type_length.php

diff --git a/db/migrations/1.328_resize_oer_content_type_length.php b/db/migrations/1.328_resize_oer_content_type_length.php
new file mode 100755
index 00000000000..0fd36b622c3
--- /dev/null
+++ b/db/migrations/1.328_resize_oer_content_type_length.php
@@ -0,0 +1,25 @@
+<?php
+
+class ResizeOerContentTypeLength extends \Migration
+{
+    public function description()
+    {
+        return 'Makes the database field of oer_material`s content_type longer so that it is conform to the rfc.';
+    }
+
+    public function up()
+    {
+        \DBManager::get()->exec("
+            ALTER TABLE `oer_material`
+            CHANGE COLUMN `content_type` `content_type` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
+        ");
+    }
+
+    public function down()
+    {
+        \DBManager::get()->exec("
+            ALTER TABLE `oer_material`
+            CHANGE COLUMN `content_type` `content_type` varchar(64) NOT NULL
+        ");
+    }
+}
-- 
GitLab