make utf8mb4_unicode_ci default collation for new mysql tables#1875
make utf8mb4_unicode_ci default collation for new mysql tables#1875dereuromark merged 2 commits intocakephp:0.nextfrom MasterOdin:mysql_default_collation
Conversation
|
Something I failed to think about within the original PR is that for a primary key within InnoDB for MySQL, the max number of bytes for 5.7 is 255 chars for utf8 (which use 3 bytes per character) and 191 for utf8mb4. This makes transitioning a bit more difficult for the default case of something like: $table = $this->table('table1', ['id' => false, 'primary_key' => ['column1']]);
$table->addColumn('column1', 'string')
->addColumn('column2', 'integer')
->create();Should the default of string be made |
|
For right now, I'm leaving this open, but not necessarily coming back to it for a period as I would like to re-examine how other migration software handle default limits for string / varchar type, especially as it might concern to primary keys. |
|
Just use charset: utf8mb4 as commented above and we can merge this |
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
|
@dereuromark done. I decided to just insert a note in the documentation about having to explicitly set the primary key length for MySQL 5.7 and below when using the Said note should probably be replicated into the changelog notes as well on release of 0.13 just to increasingly drive awareness of that fact. |
closes #1763
This makes
utf8mb4_general_cithe default collation for MySQL tables overutf8_general_ci. The prior default made sense 7+ years ago when computing power for servers was more limited, but nowadays, the performance gained is increasingly minimal over the necessary deal of handling the greater nuances of capitalization of different languages and their characters by default that the originalutf8schema lacked for MySQL.