From 76cb1ad26ed02c20be94f76c244b1c973624acfc Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Thu, 31 Dec 2015 01:03:40 +0100 Subject: [PATCH] Reduce email and realname columns to 191 chars The varchar(255) implemented to address issue #8017 was causing issues with utf8mb4 encoding due a limitation in the size of indexes in MySQL. Fixes #20465 --- admin/schema.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/admin/schema.php b/admin/schema.php index bb1b6e8fd7..bfc5f1bd5f 100644 --- a/admin/schema.php +++ b/admin/schema.php @@ -828,17 +828,16 @@ $g_upgrade[194] = array( 'UpdateFunction', 'check_token_serialization', array() ); $g_upgrade[195] = array( 'UpdateFunction', 'stored_filter_migrate', array() ); -# Step 196 used to increase length of user.username column to 255 chars. -# This was causing issues with utf8mb4 charset on MySQL / InnoDB engine; -# the column will be reduced to 191 chars (see upgrade step 206 below). +# Steps 196, 197 and 199 used to increase length of user.username, user.realname +# and user.email columns to 255 chars. This causes issues with utf8mb4 charset +# on MySQL when using the InnoDB engine due to a limitation on index key size +# to 767 bytes. +# The columns will be reduced to 191 chars (see upgrade steps 206-208 below). $g_upgrade[196] = null; - -$g_upgrade[197] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), " - realname C(255) $t_notnull DEFAULT \" '' \"" ) ); +$g_upgrade[197] = null; $g_upgrade[198] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), " password C(64) $t_notnull DEFAULT \" '' \"" ) ); -$g_upgrade[199] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), " - email C(255) $t_notnull DEFAULT \" '' \"" ) ); +$g_upgrade[199] = null; # Release marker: 1.3.0-beta.1 - 1.3.0-beta.3 @@ -869,8 +868,13 @@ # Enable gravatar plugin if avatars are enabled $g_upgrade[205] = array( 'UpdateFunction', 'gravatar_plugin', array() ); +# Limiting column size, planning for future MySQL utf8mb4 support (see #20465) $g_upgrade[206] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), " username C(191) $t_notnull DEFAULT \" '' \"" ) ); +$g_upgrade[207] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), " + realname C(191) $t_notnull DEFAULT \" '' \"" ) ); +$g_upgrade[208] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), " + email C(191) $t_notnull DEFAULT \" '' \"" ) ); # Release marker: 1.3.0