[MySQL] Deprecate automatically setting collation to {charset}_unicode_ci
as it can produce invalid collations
#5353
Labels
{charset}_unicode_ci
as it can produce invalid collations
#5353
While working on doctrine/orm#9636 I noticed that the AbstractMySQLPlatform does something really weird.
When you define
charset
for the Table options, without defining thecollation
, it will automatically construct thecollation
like this:dbal/src/Platforms/AbstractMySQLPlatform.php
Lines 459 to 462 in 719663b
This is naive, as it assumes that there is always a
_unicode_ci
for every givencharset
. For exampe, If I set thecharset
toascii
it tries to createascii_unicode_ci
which doesn't exist.I think a deprecation should be triggered when
charset
is defined without specifying thecollation
. It teaches people to define both.I also think that this is weird:
dbal/src/Platforms/AbstractMySQLPlatform.php
Lines 448 to 451 in 719663b
It uses the default
utf8
alias which points toutf8mb3
which is not compatible with UTF8. It should beutf8mb4
. So maybe instead of setting this default, not do it, and or trigger a deprecation.References:
/cc @greg0ire
The text was updated successfully, but these errors were encountered: