schmittjoh / JMSTranslationBundle

Puts the Symfony2 Translation Component on steroids
http://jmsyst.com/bundles/JMSTranslationBundle
426 stars 292 forks source link

CREATE TABLE ext_translations Specified key was too long; max key length is 767 bytes #499

Open PaddyLock opened 6 years ago

PaddyLock commented 6 years ago
Q A
1.4.3
4
7.2

Expected behavior

doctrine:schema:create should create the table ext_translations

Actual behavior

Schema-Tool failed with Error 'An exception occurred while executing 'CREAT  
  E TABLE ext_translations (id INT AUTO_INCREMENT NOT NULL, locale VARCHAR(8)  
   NOT NULL, object_class VARCHAR(255) NOT NULL, field VARCHAR(32) NOT NULL,   
  foreign_key VARCHAR(64) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX tran  
  slations_lookup_idx (locale, object_class, foreign_key), UNIQUE INDEX looku  
  p_unique_idx (locale, object_class, field, foreign_key), PRIMARY KEY(id)) D  
  EFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW  
  _FORMAT = DYNAMIC':                                                          

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t  
  oo long; max key length is 767 bytes' while executing DDL: CREATE TABLE ext  
  _translations (id INT AUTO_INCREMENT NOT NULL, locale VARCHAR(8) NOT NULL,   
  object_class VARCHAR(255) NOT NULL, field VARCHAR(32) NOT NULL, foreign_key  
   VARCHAR(64) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX translations_lo  
  okup_idx (locale, object_class, foreign_key), UNIQUE INDEX lookup_unique_id  
  x (locale, object_class, field, foreign_key), PRIMARY KEY(id)) DEFAULT CHAR  
  ACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = D  
  YNAMIC 

Steps to reproduce

run on MySQL version 5.6 INNODB utf8mb4

php bin/console doctrine:schema:create -n

If I run on MySQL version 5.7.21 INNODB utf8mb4 then it creates the table fine.

Does this bundle require MySQL version 5.7 + ?

Also

According to this stackoverflow [(https://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes)] the VARCHAR should be set to 191 for utf8mb4 ?

PaddyLock commented 6 years ago

Does this bundle require MySQL version 5.7 + ?