File 0001-On-mysql-5.6-191-bytes-length-is-the-best-we-can-do-.patch of Package roundcubemail-selfcontained
From 1afa0ac29bb2478ca527c68cc72825d11121c922 Mon Sep 17 00:00:00 2001
From: Christian Mollekopf <mollekopf@apheleia-it.ch>
Date: Mon, 20 Mar 2023 10:54:43 +0100
Subject: [PATCH] On mysql 5.6 191 bytes length is the best we can do with
utf8mb4
https://stackoverflow.com/questions/1814532/mysql-error-1071-specified-key-was-too-long-max-key-length-is-767-bytes
These changes are only required on centos 7
---
SQL/mysql/2020020101.sql | 16 +++++++++-------
SQL/mysql/2020091000.sql | 4 ++--
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/SQL/mysql/2020020101.sql b/SQL/mysql/2020020101.sql
index 0a0402ba5..ec9620e93 100644
--- a/SQL/mysql/2020020101.sql
+++ b/SQL/mysql/2020020101.sql
@@ -26,6 +26,15 @@ ALTER TABLE `searches` ROW_FORMAT=DYNAMIC;
ALTER TABLE `filestore` ROW_FORMAT=DYNAMIC;
ALTER TABLE `system` ROW_FORMAT=DYNAMIC;
+
+ALTER TABLE `users` CHANGE `username` `username` varchar(128) BINARY NOT NULL;
+ALTER TABLE `cache` CHANGE `cache_key` `cache_key` varchar(128) BINARY NOT NULL;
+ALTER TABLE `cache_shared` CHANGE `cache_key` `cache_key` varchar(191) BINARY NOT NULL;
+ALTER TABLE `cache_index` CHANGE `mailbox` `mailbox` varchar(191) BINARY NOT NULL;
+ALTER TABLE `cache_thread` CHANGE `mailbox` `mailbox` varchar(191) BINARY NOT NULL;
+ALTER TABLE `cache_messages` CHANGE `mailbox` `mailbox` varchar(191) BINARY NOT NULL;
+
+
ALTER TABLE `session` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `users` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `cache` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@@ -41,13 +50,6 @@ ALTER TABLE `searches` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_
ALTER TABLE `filestore` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `system` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-ALTER TABLE `users` CHANGE `username` `username` varchar(128) BINARY NOT NULL;
-ALTER TABLE `cache` CHANGE `cache_key` `cache_key` varchar(128) BINARY NOT NULL;
-ALTER TABLE `cache_shared` CHANGE `cache_key` `cache_key` varchar(255) BINARY NOT NULL;
-ALTER TABLE `cache_index` CHANGE `mailbox` `mailbox` varchar(255) BINARY NOT NULL;
-ALTER TABLE `cache_thread` CHANGE `mailbox` `mailbox` varchar(255) BINARY NOT NULL;
-ALTER TABLE `cache_messages` CHANGE `mailbox` `mailbox` varchar(255) BINARY NOT NULL;
-
ALTER TABLE `cache`
ADD CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `cache_index`
diff --git a/SQL/mysql/2020091000.sql b/SQL/mysql/2020091000.sql
index aa098e35d..fd5698c35 100644
--- a/SQL/mysql/2020091000.sql
+++ b/SQL/mysql/2020091000.sql
@@ -1,8 +1,8 @@
CREATE TABLE `collected_addresses` (
`address_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
- `name` varchar(255) NOT NULL DEFAULT '',
- `email` varchar(255) NOT NULL,
+ `name` varchar(191) NOT NULL DEFAULT '',
+ `email` varchar(191) NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`type` int(10) UNSIGNED NOT NULL,
PRIMARY KEY(`address_id`),
--
2.39.2