Symfony 4 SQLSTATE[42000] Specified key was too long

Hi i get the same error : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

I fix it with change length to 191 like this : @ORM\Column(type="string", length=191, unique=true)


error : In PDOConnection.php line 88: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t oo long; max key length is 767 bytes

framework : Symfony 4.4

Solution :

Update the file config/doctrine.yaml

doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'
        server_version : '5.0'
        charset: utf8
        default_table_options:
            charset: utf8
            collate: utf8_unicode_ci