Skip to content

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

@peter-si

Description

@peter-si

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions