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

Wrong SQL generated for MySQL when using TEXT type with unique index #501

Open
peter-si opened this issue Jun 15, 2023 · 0 comments
Open

Comments

@peter-si
Copy link

peter-si commented Jun 15, 2023

Hi, we encountered an issue with generated doctrine migration on MySQL 8.0.26 when specifying unique index with text type field

In ExceptionConverter.php line 117:
                                                                               
  An exception occurred while executing a query: SQLSTATE[42000]: Syntax erro  
  r or access violation: 1170 BLOB/TEXT column 'token' used in key specificat  
  ion without a key length                                                     
                                                                               
In Exception.php line 28:
                                                                               
  SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 't  
  oken' used in key specification without a key length                         
                                                                               
In Connection.php line 70:
                                                                               
  SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 't  
  oken' used in key specification without a key length 

On mariadb the generated code works ok, however on mysql it throws above mentioned error. We were trying to set a specific version in the bundle config with 'server_version' => '8.0.26', to hint that we are using mysql, not mariadb but that didn't help.

In the end we solved it by removing the unique index. I would expect to get an exception on generation?

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