Description
I am trying to migrate from 7.14.4 to 8.6.1 following the
migration instructions
Everything goes well until the post upgrade command, where the following error is encountered:
SuiteCRM Finalize Upgrade
============
Running: legacy-post-upgrade
step: legacy-post-upgrade | status: done
Post Upgrade process complete
Running: add-new-config-entries
step: add-new-config-entries | status: done
No new entries to add to the config file
Running: metadata-merge
step: metadata-merge | status: done
Metadata successfully merged
Running: run-migrations
step: run-migrations | status: failed
Error running migrations
In ./logs/upgrade.log I get:
CRITICAL [console] Error thrown while running command "doctrine:migrations:migrate --no-interaction --allow-no-migration". Message: "An exception occurred while executing 'CREATE TABLE migration_versions (version VARCHAR(1024) NOT NULL, executed_at DATETIME DEFAULT NULL, execution_time INT DEFAULT NULL, PRIMARY KEY(version)) DEFAULT CHARACTER SET utf8 COLLATE
utf8_unicode_ciENGINE = InnoDB':\n\nSQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 3072 bytes" ["exception" => Doctrine\DBAL\Exception\DriverException { …},"command" => "doctrine:migrations:migrate --no-interaction --allow-no-migration","message" => """ An exception occurred while executing 'CREATE TABLE migration_versions (version VARCHAR(1024) NOT NULL, executed_at DATETIME DEFAULT NULL, execution_time INT DEFAULT NULL, PRIMARY KEY(version)) DEFAULT CHARACTER SET utf8 COLLATE
utf8_unicode_ci ENGINE = InnoDB':\n \n SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 3072 bytes """]
My understanding The error occurs when creating the migration_versions
table, which has a primary key column version
with a length of 1024 characters. This exceeds the default maximum key length of 3072 bytes (or 3072 characters if using a single-byte character set like latin1
).
Since the table is using the utf8_unicode_ci
character set, which can use up to 4 bytes per character, a 1024-character column can potentially exceed the 3072-byte limit for index keys.
Expected Behavior According to the MariaDB 10.11 documentation, the innodb_file_per_table
and innodb_file_format=Barracuda
settings are enabled by default, which should allow creating tables with index keys longer than 3072 bytes.
Actual Behavior Despite the default settings in MariaDB 10.11, the “Specified key was too long; max key length is 3072 bytes” error is encountered when creating the migration_versions
table.
Environment
- VPS
- SuiteCRM in Docker, based on php8.2-apache
- PHP 8.2
- MariaDB in Docker, version: 10.11
- SuiteCRM version: 7.14.4 / 8.6.1
- Operating System: Linux
Attachments
- MariaDB configuration file (
my.cnf
)
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[server]
character-set-client-handshake = FALSE
collation-server = utf8mb4_unicode_ci
init-connect = 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci'
character-set-server = utf8mb4
- database configuration for SuiteCRM (
config.php
)
'dbconfig' =>
array (
'db_host_name' => '[edited]',
'db_host_instance' => '',
'db_user_name' => '[edited]',
'db_password' => '[edited]',
'db_name' => '[edited]',
'db_type' => 'mysql',
'db_port' => '3306',
'db_manager' => 'MysqliManager',
'collation' => 'utf8mb4_unicode_ci',
'charset' => 'utf8mb4',
),
'dbconfigoption' =>
array (
'persistent' => true,
'autofree' => false,
'debug' => 0,
'ssl' => false,
'collation' => 'utf8mb4_unicode_ci',
'charset' => 'utf8mb4',
),
Attempted Solutions
- Upgraded MariaDB server to 11.1 (I know it is not in the compatibility matrix, but maybe it could have solved this specific problem) → same error occurs.
Additional Information
I have searched fairly extensively but similar errors seem to happen in different contexts with older database versions - with MariaDB 10.11 or up it should not happen.
Any ideas?