3.1.1.4 to 3.1.2 upgrade fails with maximum column size error

Hello all,

I have tried upgrading my OJS to latest version but when it comes to database upgrade part - it fails with following error:

A database error has occurred: Index column size too large. The maximum column size is 767 bytes.

I tried running via php CLI too - same thing happens in a more “verbose” way:

[schema: lib/pkp/xml/schema/categories.xml]
PHP Notice: Only variables should be passed by reference in /var/www/toms.com.hr/lib/pkp/lib/adodb/adodb-xmlschema.inc.php on line 267
PHP Notice: Only variables should be passed by reference in /var/www/toms.com.hr/lib/pkp/lib/adodb/adodb-xmlschema.inc.php on line 267
PHP Notice: Only variables should be passed by reference in /var/www/toms.com.hr/lib/pkp/lib/adodb/adodb-xmlschema.inc.php on line 267
PHP Notice: Only variables should be passed by reference in /var/www/toms.com.hr/lib/pkp/lib/adodb/adodb-xmlschema.inc.php on line 267
ERROR: Upgrade failed: DB: Index column size too large. The maximum column size is 767 bytes.

Does anyone know how to fix this?

I get this same error only i’m upgrading from 2.4.8 to 3.1.1-4
It fails on the alter statement:
ALTER TABLE submission_file_settings ADD UNIQUE INDEX submission_file_settings_pkey (file_id, locale, setting_name)

Hi @jhennig,

What database management system (MariaDB? MySQL?) and version are you using? What character encoding and collation are set in your database? What encoding is mentioned in OJS config file?

Sorry for the late reply. I deleted and restored the database and pdf files then ran the upgrade again and it worked the second go around. I’m not exactly sure what I missed the first time. It was a while ago sorry.
The DB was MariaDB and all charsets are utf-8

1 Like

Hello,

I’m getting the same error and I have made two attempts—with two different versions and two separate DB migrations—to no avail. I get the error:

Upgrade failed: DB: Index column size too large. The maximum column size is 767 bytes.

After running:

php tools/upgrade.php upgrade

From version 3.1.2.1 to 3.2.0.

Any help would be much appreciated.

Thanks,

Jamil

I was able to fix this issue by correcting the encoding of my database. I was using utf8mb4 (and utf8mb4_general_ci collation) but the table collation was set to utf8_general_ci. I just created a new database and corrected the collation and dumped and imported the old data in a UTF-8 safe way. After that the DB upgrade went just fine.

1 Like