From 46e0b8761ead1e9ac24d6b39385644c3678ac39c Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Thu, 15 Mar 2018 22:23:40 +0100 Subject: [PATCH] tests: fix Specified key was too long; in a schema MediaWikiTestCaseSchemaTest.sql comes with two varchar(255) combined into a PRIMARY KEY. That caused the testsuite to fail creating that imagelinks table with: Error: 1071 Specified key was too long; max key length is 767 bytes That is the limit for innodb and when using UTF8 it allows up to 3 bytes per characters. Hence the key can be (255+255)*3 = 1530. One can tune MySQL to bump the limit to ~ 3k with: innodb_large_prefix = 1 Seems easier to just use smaller fields. Change-Id: Ic4965b9eddc7ad9105c896e678ab9048ce0be8ef --- tests/phpunit/tests/MediaWikiTestCaseSchemaTest.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/MediaWikiTestCaseSchemaTest.sql b/tests/phpunit/tests/MediaWikiTestCaseSchemaTest.sql index 43e8e9ba34..58460e2e9f 100644 --- a/tests/phpunit/tests/MediaWikiTestCaseSchemaTest.sql +++ b/tests/phpunit/tests/MediaWikiTestCaseSchemaTest.sql @@ -7,7 +7,7 @@ CREATE TABLE /*_*/MediaWikiTestCaseTestTable ( CREATE TABLE /*_*/imagelinks ( il_from int NOT NULL DEFAULT 0, il_from_namespace int NOT NULL DEFAULT 0, - il_to varchar(255) NOT NULL DEFAULT '', - il_frobniz varchar(255) NOT NULL DEFAULT 'FROB', + il_to varchar(127) NOT NULL DEFAULT '', + il_frobniz varchar(127) NOT NULL DEFAULT 'FROB', PRIMARY KEY (il_from,il_to) ) /*$wgDBTableOptions*/; -- 2.20.1