Skip to content

Commit

Permalink
Reduce email and realname columns to 191 chars
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dregad committed Jun 11, 2016
1 parent ab9db31 commit 76cb1ad
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions admin/schema.php
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 76cb1ad

Please sign in to comment.