Skip to content
Advertisement

Doctrine migrations table collation

Trying to find a way to programatically create tables with certain collation, but can’t seem to find a way how to do it properly. I am using the “doctrine/doctrine-migrations-bundle”: “2.1.*@dev” and Symfony 2.3,

I set up in my config.yml:

JavaScript

It creates the database with LATIN1 charset and latin1_swedish_ci as default collation, when I run doctrine:database:create tool. Then I run my migrations, and all the tables are utf8_general_ci

Looked into the $schema->createTable() function, but cannot find the way to pass the collation I need to that. What is the proper workaround here?

Advertisement

Answer

Well, thats kind of ugly, but the only way I have found is to generate after all tables another set of migrations that altered the table and converted the encoding. the migration up() and down() functions looked like:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement