wave icon indicating copy to clipboard operation
wave copied to clipboard

Fix migration step

Open NawrasBukhari opened this issue 3 years ago • 1 comments
trafficstars

To fix the following error while migrating: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table translations add unique translations_table_name_column_name_foreign_key_locale_unique(table_name, column_name, foreign_key, locale))

NawrasBukhari avatar Jul 03 '22 11:07 NawrasBukhari

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

It sounds like your MySQL installation might be older than 8.0? InnoDB is the default storage engine for MySQL 8.0+, older versions use the MyISAM storage engine as default. You can check which storage engine your database uses by running the following SQL. Change DATABASE_NAME to your database, which should return a list of each table and its storage engine.

SELECT TABLE_NAME, ENGINE
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'DATABASE_NAME';

You can append and ENGINE = 'MyISAM' if you want to search for a specific engine.

If any table uses MyISAM you can alter the table to use InnoDB using the following SQL. Substitute the TABLE_NAME with the name of the table you want to alter.

ALTER TABLE TABLE_NAME ENGINE=InnoDB;

thinkverse avatar Jul 05 '22 15:07 thinkverse