From bc371868444bf0d5e84afdf3ff376e446512ff5b Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 12 Jun 2019 14:14:44 -0400
Subject: [PATCH] Fix database upgrader mediumtext support.

---
 module/VuFind/sql/mysql.sql                              | 2 +-
 module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/module/VuFind/sql/mysql.sql b/module/VuFind/sql/mysql.sql
index 5bcf1df8a83..f500d8e70ae 100644
--- a/module/VuFind/sql/mysql.sql
+++ b/module/VuFind/sql/mysql.sql
@@ -171,7 +171,7 @@ CREATE TABLE `external_session` (
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `shortlinks` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
-  `path` MEDIUMTEXT NOT NULL,
+  `path` mediumtext NOT NULL,
   `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
diff --git a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php
index 1be1b4663c8..b00bd2737e1 100644
--- a/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php
+++ b/module/VuFind/src/VuFind/Controller/Plugin/DbUpgrade.php
@@ -791,7 +791,9 @@ class DbUpgrade extends AbstractPlugin
 
         // If it's not a blob or a text (which don't have explicit sizes in our SQL),
         // we should see what the character length is, if any:
-        if ($type != 'blob' && $type != 'text' && $type != 'longtext') {
+        if ($type != 'blob' && $type != 'text' && $type !== 'mediumtext'
+            && $type != 'longtext'
+        ) {
             $charLen = $column->getCharacterMaximumLength();
             if ($charLen) {
                 $type .= '(' . $charLen . ')';
-- 
GitLab