I am trying to create database from Entity in Symfony 4. However the result is:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
I know this is because it is trying to use utf8mb4 charset and utf8mb4_unicode_ci collation. I've tried to replace my doctrine.yaml file to utf8 and utf8_unicode_ci as well as:
@ORM\Table(name="users", options={"collate"="utf8_unicode_ci", "charset"="utf8", "engine"="MyISAM"})
But it's still trying to use utf88mb4. How can I force it to use utf8?
OK I have found an answer, so basically I had a lot of migration files and php was constantly trying to create database with old configuration. To properly create it I deleted Migrations directory and used
php bin/console doctrine:cache:clear-metadata
.
That helped, now creator used new configuration.
This is not a complete answer unfortunately. I'm having the same issue with the SQL code generated by Symfony migrations, but I'm running the code directly on the database. I think there's an underlying issue with Doctrine.