Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PaddyLock opened this issue Sep 21, 2018 · 1 comment

Comments

@PaddyLock
Copy link

PaddyLock commented Sep 21, 2018

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
Copy link
Author

Does this bundle require MySQL version 5.7 + ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant