From 0e8a94ac42c5f4345658d1581f9b2c7afa705a3a Mon Sep 17 00:00:00 2001
From: Frédéric Guillot <fred@kanboard.net>
Date: Thu, 12 Apr 2018 15:08:29 -0700
Subject: Adjust field size to keep compatibility with MySQL 5.6

---
 .travis.yml                              |  1 +
 app/Schema/Mysql.php                     | 19 +++++++++++++++++++
 app/Schema/Sql/mysql.sql                 | 30 +++++++++++++++---------------
 app/Template/category/edit.php           |  2 +-
 app/Template/column/create.php           |  2 +-
 app/Template/column/edit.php             |  2 +-
 app/Template/group_creation/show.php     |  2 +-
 app/Template/group_modification/show.php |  2 +-
 app/Template/project_tag/create.php      |  2 +-
 app/Template/project_tag/edit.php        |  2 +-
 app/Template/swimlane/create.php         |  2 +-
 app/Template/swimlane/edit.php           |  2 +-
 app/Template/tag/create.php              |  2 +-
 app/Template/tag/edit.php                |  2 +-
 app/Template/user_creation/show.php      |  2 +-
 app/Template/user_invite/signup.php      |  2 +-
 app/Template/user_modification/show.php  |  2 +-
 app/Validator/AuthValidator.php          |  2 +-
 app/Validator/CategoryValidator.php      |  2 +-
 app/Validator/ColumnValidator.php        |  2 +-
 app/Validator/CommentValidator.php       |  2 +-
 app/Validator/GroupValidator.php         |  2 +-
 app/Validator/PasswordResetValidator.php |  2 +-
 app/Validator/SwimlaneValidator.php      |  2 +-
 app/Validator/TagValidator.php           |  2 +-
 app/Validator/TaskValidator.php          |  2 +-
 app/Validator/UserValidator.php          |  2 +-
 27 files changed, 59 insertions(+), 39 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index ef5162cc..07fb894c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,6 +16,7 @@ php:
 env:
   - DB=sqlite
   - DB=postgres
+  - DB=mysql
 
 matrix:
   fast_finish: true
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index c5144663..efeefd9c 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -22,9 +22,28 @@ You might need to run:
 REPAIR TABLE table_name;
 OPTIMIZE TABLE table_name;
 
+The max length for Mysql 5.6 is 191 for varchar unique keys in utf8mb4
+
 */
 function version_130(PDO $pdo)
 {
+    $pdo->exec("ALTER TABLE `swimlanes` MODIFY `name` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `users` MODIFY `username` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `groups` MODIFY `name` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `links` MODIFY `label` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `tags` MODIFY `name` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `sessions` MODIFY `id` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `project_role_has_restrictions` MODIFY `rule` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `project_has_roles` MODIFY `role` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `project_has_categories` MODIFY `name` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `invites` MODIFY `email` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `invites` MODIFY `token` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `groups` MODIFY `name` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `columns` MODIFY `title` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `column_has_restrictions` MODIFY `rule` VARCHAR(191) NOT NULL");
+    $pdo->exec("ALTER TABLE `comments` MODIFY `reference` VARCHAR(191) DEFAULT ''");
+    $pdo->exec("ALTER TABLE `tasks` MODIFY `reference` VARCHAR(191) DEFAULT ''");
+
     $tables = [
         'action_has_params',
         'actions',
diff --git a/app/Schema/Sql/mysql.sql b/app/Schema/Sql/mysql.sql
index 7f46c872..fba959a9 100644
--- a/app/Schema/Sql/mysql.sql
+++ b/app/Schema/Sql/mysql.sql
@@ -64,7 +64,7 @@ CREATE TABLE `column_has_restrictions` (
   `project_id` int(11) NOT NULL,
   `role_id` int(11) NOT NULL,
   `column_id` int(11) NOT NULL,
-  `rule` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `rule` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   PRIMARY KEY (`restriction_id`),
   UNIQUE KEY `role_id` (`role_id`,`column_id`,`rule`),
   KEY `project_id` (`project_id`),
@@ -79,7 +79,7 @@ DROP TABLE IF EXISTS `columns`;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `columns` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
-  `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `position` int(11) NOT NULL,
   `project_id` int(11) NOT NULL,
   `task_limit` int(11) DEFAULT '0',
@@ -100,7 +100,7 @@ CREATE TABLE `comments` (
   `user_id` int(11) DEFAULT '0',
   `date_creation` bigint(20) DEFAULT NULL,
   `comment` mediumtext COLLATE utf8mb4_unicode_ci,
-  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
+  `reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT '',
   `date_modification` bigint(20) DEFAULT NULL,
   PRIMARY KEY (`id`),
   KEY `user_id` (`user_id`),
@@ -154,7 +154,7 @@ DROP TABLE IF EXISTS `groups`;
 CREATE TABLE `groups` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `external_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
-  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `name` (`name`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@@ -163,9 +163,9 @@ DROP TABLE IF EXISTS `invites`;
 /*!40101 SET @saved_cs_client     = @@character_set_client */;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `invites` (
-  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `project_id` int(11) NOT NULL,
-  `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   PRIMARY KEY (`email`,`token`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 /*!40101 SET character_set_client = @saved_cs_client */;
@@ -189,7 +189,7 @@ DROP TABLE IF EXISTS `links`;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `links` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
-  `label` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `label` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `opposite_id` int(11) DEFAULT '0',
   PRIMARY KEY (`id`),
   UNIQUE KEY `label` (`label`)
@@ -291,7 +291,7 @@ DROP TABLE IF EXISTS `project_has_categories`;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `project_has_categories` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
-  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `project_id` int(11) NOT NULL,
   `description` mediumtext COLLATE utf8mb4_unicode_ci,
   PRIMARY KEY (`id`),
@@ -360,7 +360,7 @@ DROP TABLE IF EXISTS `project_has_roles`;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `project_has_roles` (
   `role_id` int(11) NOT NULL AUTO_INCREMENT,
-  `role` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `role` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `project_id` int(11) NOT NULL,
   PRIMARY KEY (`role_id`),
   UNIQUE KEY `project_id` (`project_id`,`role`),
@@ -387,7 +387,7 @@ CREATE TABLE `project_role_has_restrictions` (
   `restriction_id` int(11) NOT NULL AUTO_INCREMENT,
   `project_id` int(11) NOT NULL,
   `role_id` int(11) NOT NULL,
-  `rule` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `rule` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   PRIMARY KEY (`restriction_id`),
   UNIQUE KEY `role_id` (`role_id`,`rule`),
   KEY `project_id` (`project_id`),
@@ -447,7 +447,7 @@ DROP TABLE IF EXISTS `sessions`;
 /*!40101 SET @saved_cs_client     = @@character_set_client */;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `sessions` (
-  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `expire_at` int(11) NOT NULL,
   `data` longtext COLLATE utf8mb4_unicode_ci,
   PRIMARY KEY (`id`)
@@ -503,7 +503,7 @@ DROP TABLE IF EXISTS `swimlanes`;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `swimlanes` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
-  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `position` int(11) DEFAULT '1',
   `is_active` int(11) DEFAULT '1',
   `project_id` int(11) DEFAULT NULL,
@@ -519,7 +519,7 @@ DROP TABLE IF EXISTS `tags`;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `tags` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
-  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `project_id` int(11) NOT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `project_id` (`project_id`,`name`)
@@ -622,7 +622,7 @@ CREATE TABLE `tasks` (
   `category_id` int(11) DEFAULT '0',
   `creator_id` int(11) DEFAULT '0',
   `date_modification` int(11) DEFAULT '0',
-  `reference` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
+  `reference` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT '',
   `date_started` bigint(20) DEFAULT NULL,
   `time_spent` float DEFAULT '0',
   `time_estimated` float DEFAULT '0',
@@ -730,7 +730,7 @@ DROP TABLE IF EXISTS `users`;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `users` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
-  `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
   `password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
   `is_ldap_user` tinyint(1) DEFAULT '0',
   `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
diff --git a/app/Template/category/edit.php b/app/Template/category/edit.php
index 08231606..cd8ee7ba 100644
--- a/app/Template/category/edit.php
+++ b/app/Template/category/edit.php
@@ -6,7 +6,7 @@
     <?= $this->form->csrf() ?>
 
     <?= $this->form->label(t('Category Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="255"', 'tabindex="1"')) ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="191"', 'tabindex="1"')) ?>
 
     <?= $this->form->label(t('Description'), 'description') ?>
     <?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?>
diff --git a/app/Template/column/create.php b/app/Template/column/create.php
index 2ea88eea..034e948c 100644
--- a/app/Template/column/create.php
+++ b/app/Template/column/create.php
@@ -5,7 +5,7 @@
     <?= $this->form->csrf() ?>
 
     <?= $this->form->label(t('Title'), 'title') ?>
-    <?= $this->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="255"', 'tabindex="1"')) ?>
+    <?= $this->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="191"', 'tabindex="1"')) ?>
 
     <?= $this->form->label(t('Task limit'), 'task_limit') ?>
     <?= $this->form->number('task_limit', $values, $errors, array('tabindex="2"')) ?>
diff --git a/app/Template/column/edit.php b/app/Template/column/edit.php
index 2025405f..def0f299 100644
--- a/app/Template/column/edit.php
+++ b/app/Template/column/edit.php
@@ -6,7 +6,7 @@
     <?= $this->form->csrf() ?>
 
     <?= $this->form->label(t('Title'), 'title') ?>
-    <?= $this->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="255"')) ?>
+    <?= $this->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="191"')) ?>
 
     <?= $this->form->label(t('Task limit'), 'task_limit') ?>
     <?= $this->form->number('task_limit', $values, $errors) ?>
diff --git a/app/Template/group_creation/show.php b/app/Template/group_creation/show.php
index 0b26105b..7cec0755 100644
--- a/app/Template/group_creation/show.php
+++ b/app/Template/group_creation/show.php
@@ -5,7 +5,7 @@
     <?= $this->form->csrf() ?>
 
     <?= $this->form->label(t('Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="255"')) ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="191"')) ?>
 
     <?= $this->modal->submitButtons() ?>
 </form>
diff --git a/app/Template/group_modification/show.php b/app/Template/group_modification/show.php
index c314a412..aa647775 100644
--- a/app/Template/group_modification/show.php
+++ b/app/Template/group_modification/show.php
@@ -8,7 +8,7 @@
     <?= $this->form->hidden('external_id', $values) ?>
 
     <?= $this->form->label(t('Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="255"')) ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="191"')) ?>
 
     <?= $this->modal->submitButtons() ?>
 </form>
diff --git a/app/Template/project_tag/create.php b/app/Template/project_tag/create.php
index 6765e8fc..d665aa76 100644
--- a/app/Template/project_tag/create.php
+++ b/app/Template/project_tag/create.php
@@ -5,7 +5,7 @@
     <?= $this->form->csrf() ?>
 
     <?= $this->form->label(t('Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="255"')) ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="191"')) ?>
 
     <?= $this->modal->submitButtons() ?>
 </form>
diff --git a/app/Template/project_tag/edit.php b/app/Template/project_tag/edit.php
index 29290c0c..39b08326 100644
--- a/app/Template/project_tag/edit.php
+++ b/app/Template/project_tag/edit.php
@@ -5,7 +5,7 @@
     <?= $this->form->csrf() ?>
 
     <?= $this->form->label(t('Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="255"')) ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="191"')) ?>
 
     <?= $this->modal->submitButtons() ?>
 </form>
diff --git a/app/Template/swimlane/create.php b/app/Template/swimlane/create.php
index 02825547..b769c6ce 100644
--- a/app/Template/swimlane/create.php
+++ b/app/Template/swimlane/create.php
@@ -5,7 +5,7 @@
     <?= $this->form->csrf() ?>
 
     <?= $this->form->label(t('Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="255"', 'tabindex="1"')) ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="191"', 'tabindex="1"')) ?>
 
     <?= $this->form->label(t('Description'), 'description') ?>
     <?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?>
diff --git a/app/Template/swimlane/edit.php b/app/Template/swimlane/edit.php
index 205dc95d..f15a6dfb 100644
--- a/app/Template/swimlane/edit.php
+++ b/app/Template/swimlane/edit.php
@@ -6,7 +6,7 @@
     <?= $this->form->csrf() ?>
 
     <?= $this->form->label(t('Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="255"', 'tabindex="1"')) ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="191"', 'tabindex="1"')) ?>
 
     <?= $this->form->label(t('Description'), 'description') ?>
     <?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?>
diff --git a/app/Template/tag/create.php b/app/Template/tag/create.php
index 752a63e5..c376eb28 100644
--- a/app/Template/tag/create.php
+++ b/app/Template/tag/create.php
@@ -6,7 +6,7 @@
     <?= $this->form->hidden('project_id', $values) ?>
 
     <?= $this->form->label(t('Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="255"')) ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="191"')) ?>
 
     <?= $this->modal->submitButtons() ?>
 </form>
diff --git a/app/Template/tag/edit.php b/app/Template/tag/edit.php
index adef3568..a0e54843 100644
--- a/app/Template/tag/edit.php
+++ b/app/Template/tag/edit.php
@@ -7,7 +7,7 @@
     <?= $this->form->hidden('project_id', $values) ?>
 
     <?= $this->form->label(t('Name'), 'name') ?>
-    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="255"')) ?>
+    <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="191"')) ?>
 
     <?= $this->modal->submitButtons() ?>
 </form>
diff --git a/app/Template/user_creation/show.php b/app/Template/user_creation/show.php
index 90301dbd..d1bde192 100644
--- a/app/Template/user_creation/show.php
+++ b/app/Template/user_creation/show.php
@@ -10,7 +10,7 @@
                 <legend><?= t('Profile') ?></legend>
 
                 <?= $this->form->label(t('Username'), 'username') ?>
-                <?= $this->form->text('username', $values, $errors, array('autofocus', 'required', 'maxlength="255"')) ?>
+                <?= $this->form->text('username', $values, $errors, array('autofocus', 'required', 'maxlength="191"')) ?>
 
                 <?= $this->form->label(t('Name'), 'name') ?>
                 <?= $this->form->text('name', $values, $errors) ?>
diff --git a/app/Template/user_invite/signup.php b/app/Template/user_invite/signup.php
index c5c50217..88dee216 100644
--- a/app/Template/user_invite/signup.php
+++ b/app/Template/user_invite/signup.php
@@ -9,7 +9,7 @@
             <legend><?= t('Profile') ?></legend>
 
             <?= $this->form->label(t('Username'), 'username') ?>
-            <?= $this->form->text('username', $values, $errors, array('autofocus', 'required', 'maxlength="255"')) ?>
+            <?= $this->form->text('username', $values, $errors, array('autofocus', 'required', 'maxlength="191"')) ?>
 
             <?= $this->form->label(t('Name'), 'name') ?>
             <?= $this->form->text('name', $values, $errors) ?>
diff --git a/app/Template/user_modification/show.php b/app/Template/user_modification/show.php
index 2bca6675..a21b9d33 100644
--- a/app/Template/user_modification/show.php
+++ b/app/Template/user_modification/show.php
@@ -8,7 +8,7 @@
     <fieldset>
         <legend><?= t('Profile') ?></legend>
         <?= $this->form->label(t('Username'), 'username') ?>
-        <?= $this->form->text('username', $values, $errors, array('autofocus', 'required', isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1 && !$this->user->isAdmin() ? 'readonly' : '', 'maxlength="255"')) ?>
+        <?= $this->form->text('username', $values, $errors, array('autofocus', 'required', isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1 && !$this->user->isAdmin() ? 'readonly' : '', 'maxlength="191"')) ?>
 
         <?= $this->form->label(t('Name'), 'name') ?>
         <?= $this->form->text('name', $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_name') ? '' : 'readonly')) ?>
diff --git a/app/Validator/AuthValidator.php b/app/Validator/AuthValidator.php
index daa913c0..e50f90ce 100644
--- a/app/Validator/AuthValidator.php
+++ b/app/Validator/AuthValidator.php
@@ -37,7 +37,7 @@ class AuthValidator extends BaseValidator
     {
         $v = new Validator($values, array(
             new Validators\Required('username', t('The username is required')),
-            new Validators\MaxLength('username', t('The maximum length is %d characters', 255), 255),
+            new Validators\MaxLength('username', t('The maximum length is %d characters', 191), 191),
             new Validators\Required('password', t('The password is required')),
         ));
 
diff --git a/app/Validator/CategoryValidator.php b/app/Validator/CategoryValidator.php
index f5c7e0f1..1d14891c 100644
--- a/app/Validator/CategoryValidator.php
+++ b/app/Validator/CategoryValidator.php
@@ -68,7 +68,7 @@ class CategoryValidator extends BaseValidator
         return array(
             new Validators\Integer('id', t('The id must be an integer')),
             new Validators\Integer('project_id', t('The project id must be an integer')),
-            new Validators\MaxLength('name', t('The maximum length is %d characters', 255), 255)
+            new Validators\MaxLength('name', t('The maximum length is %d characters', 191), 191)
         );
     }
 }
diff --git a/app/Validator/ColumnValidator.php b/app/Validator/ColumnValidator.php
index bc6af7dd..59d3ddf6 100644
--- a/app/Validator/ColumnValidator.php
+++ b/app/Validator/ColumnValidator.php
@@ -69,7 +69,7 @@ class ColumnValidator extends BaseValidator
             new Validators\Integer('task_limit', t('This value must be an integer')),
             new Validators\GreaterThan('task_limit', t('This value must be greater than %d', -1), -1),
             new Validators\Required('title', t('The title is required')),
-            new Validators\MaxLength('title', t('The maximum length is %d characters', 255), 255),
+            new Validators\MaxLength('title', t('The maximum length is %d characters', 191), 191),
         );
     }
 }
diff --git a/app/Validator/CommentValidator.php b/app/Validator/CommentValidator.php
index c5149bad..2051cbde 100644
--- a/app/Validator/CommentValidator.php
+++ b/app/Validator/CommentValidator.php
@@ -91,7 +91,7 @@ class CommentValidator extends BaseValidator
             new Validators\Integer('id', t('This value must be an integer')),
             new Validators\Integer('task_id', t('This value must be an integer')),
             new Validators\Integer('user_id', t('This value must be an integer')),
-            new Validators\MaxLength('reference', t('The maximum length is %d characters', 255), 255),
+            new Validators\MaxLength('reference', t('The maximum length is %d characters', 191), 191),
             new Validators\Required('comment', t('Comment is required'))
         );
     }
diff --git a/app/Validator/GroupValidator.php b/app/Validator/GroupValidator.php
index 66a20eb9..5b32ed2d 100644
--- a/app/Validator/GroupValidator.php
+++ b/app/Validator/GroupValidator.php
@@ -62,7 +62,7 @@ class GroupValidator extends BaseValidator
     {
         return array(
             new Validators\Required('name', t('The name is required')),
-            new Validators\MaxLength('name', t('The maximum length is %d characters', 255), 255),
+            new Validators\MaxLength('name', t('The maximum length is %d characters', 191), 191),
             new Validators\Unique('name', t('The name must be unique'), $this->db->getConnection(), GroupModel::TABLE, 'id'),
             new Validators\MaxLength('external_id', t('The maximum length is %d characters', 255), 255),
             new Validators\Integer('id', t('This value must be an integer')),
diff --git a/app/Validator/PasswordResetValidator.php b/app/Validator/PasswordResetValidator.php
index 3c19affe..fb424e89 100644
--- a/app/Validator/PasswordResetValidator.php
+++ b/app/Validator/PasswordResetValidator.php
@@ -55,7 +55,7 @@ class PasswordResetValidator extends BaseValidator
         $v = new Validator($values, array(
             new Validators\Required('captcha', t('This value is required')),
             new Validators\Required('username', t('The username is required')),
-            new Validators\MaxLength('username', t('The maximum length is %d characters', 255), 255),
+            new Validators\MaxLength('username', t('The maximum length is %d characters', 191), 191),
         ));
 
         return array(
diff --git a/app/Validator/SwimlaneValidator.php b/app/Validator/SwimlaneValidator.php
index fb3d5f11..0df433f2 100644
--- a/app/Validator/SwimlaneValidator.php
+++ b/app/Validator/SwimlaneValidator.php
@@ -68,7 +68,7 @@ class SwimlaneValidator extends BaseValidator
         return array(
             new Validators\Integer('id', t('The id must be an integer')),
             new Validators\Integer('project_id', t('The project id must be an integer')),
-            new Validators\MaxLength('name', t('The maximum length is %d characters', 255), 255)
+            new Validators\MaxLength('name', t('The maximum length is %d characters', 191), 191)
         );
     }
 }
diff --git a/app/Validator/TagValidator.php b/app/Validator/TagValidator.php
index 0567cf3e..dddd076d 100644
--- a/app/Validator/TagValidator.php
+++ b/app/Validator/TagValidator.php
@@ -70,7 +70,7 @@ class TagValidator extends BaseValidator
         return array(
             new Validators\Required('project_id', t('Field required')),
             new Validators\Required('name', t('Field required')),
-            new Validators\MaxLength('name', t('The maximum length is %d characters', 255), 255),
+            new Validators\MaxLength('name', t('The maximum length is %d characters', 191), 191),
         );
     }
 }
diff --git a/app/Validator/TaskValidator.php b/app/Validator/TaskValidator.php
index 7f905b2d..33d80989 100644
--- a/app/Validator/TaskValidator.php
+++ b/app/Validator/TaskValidator.php
@@ -41,7 +41,7 @@ class TaskValidator extends BaseValidator
             new Validators\Integer('recurrence_status', t('This value must be an integer')),
             new Validators\Integer('priority', t('This value must be an integer')),
             new Validators\MaxLength('title', t('The maximum length is %d characters', 65535), 65535),
-            new Validators\MaxLength('reference', t('The maximum length is %d characters', 255), 255),
+            new Validators\MaxLength('reference', t('The maximum length is %d characters', 191), 191),
             new Validators\Date('date_due', t('Invalid date'), $this->dateParser->getParserFormats()),
             new Validators\Date('date_started', t('Invalid date'), $this->dateParser->getParserFormats()),
             new Validators\Numeric('time_spent', t('This value must be numeric')),
diff --git a/app/Validator/UserValidator.php b/app/Validator/UserValidator.php
index d7c5a94d..a6f1dc7d 100644
--- a/app/Validator/UserValidator.php
+++ b/app/Validator/UserValidator.php
@@ -24,7 +24,7 @@ class UserValidator extends BaseValidator
     {
         return array(
             new Validators\MaxLength('role', t('The maximum length is %d characters', 25), 25),
-            new Validators\MaxLength('username', t('The maximum length is %d characters', 255), 255),
+            new Validators\MaxLength('username', t('The maximum length is %d characters', 191), 191),
             new Validators\Unique('username', t('This username is already taken'), $this->db->getConnection(), UserModel::TABLE, 'id'),
             new Validators\Email('email', t('Email address invalid')),
             new Validators\Integer('is_ldap_user', t('This value must be an integer')),
-- 
cgit v1.2.3