DDC-3204: MySQL and Character Set utf8mb4 #3989

Closed
doctrinebot opened this Issue Jul 4, 2014 · 6 comments

5 participants

@doctrinebot

Jira issue originally created by user eatnut:

  1. My MySQL server has default character set utf8mb4 and collation utf8mb4*unicode*ci.

  2. Database created for ORM has the same character set and collation as the server.

  3. When I use command doctrine orm:schema-tool:create to create a schema, a table with character set utf8 and collation utf8*unicode_ci is created (should be utf8mb4 and utf8mb4_unicode*ci).

  4. When I use mysql client to create table, no problem at all.

I'm not sure is it intended or not, doctrine will just ignore utf8mb4 character set?

@doctrinebot

Comment created by @ocramius:

Doctrine automatically adds utf8 and utf8*unicode*ci as charset and collation in the DDL used to create tables.

You will need to manually tweak this using additional table-specific mappings.

@doctrinebot

Issue was closed with resolution "Invalid"

@Ocramius Ocramius was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
@phoenixgao

Even if I defined table-specific charset and collation, the created join table of many-to-many relation are still in UTF-8, although it's not matter because that join table will be two integer columns only, but this is still a weird behavior.

@deeky666
Doctrine member

@phoenixgao what charset and collation would you expect Doctrine to use for a join table if both primary tables would have different charset and collation definitions (besides the fact that it doesn't affect integer columns anyways as you pointed out). This is no big deal IMO.

@deeky666
Doctrine member

Please remember, in the end the charset and collation defined on the table is only used as default if no column charset is specified in the definition. So this really has no impact if you define a collation explicitly on each column.

@DHager

What happens when string identifiers are used? Does each FK column in the link-table have the appropriate/matching encoding as the corresponding PKs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment