Skip to content

Commit 2056154

Browse files
committed
Remove hardcoded default collation for MySQL tables
Let MySQL/MariaDB use the database default collation instead of forcing utf8mb4_unicode_ci on every table. This avoids collation mismatches on servers with different defaults (e.g. MariaDB 11.8 uses utf8mb4_uca1400_ai_ci). Users who need a specific collation can still set it explicitly in their migrations. Fixes #1010
1 parent 0a586ed commit 2056154

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

docs/en/writing-migrations.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,9 @@ In addition, the MySQL adapter supports following options:
519519
Option Platform Description
520520
========== ================ ===========
521521
comment MySQL, Postgres set a text comment on the table
522-
collation MySQL, SqlServer the default collation for a table if different than the database.
522+
collation MySQL, SqlServer set the table collation *(defaults to database collation)*
523523
row_format MySQL set the table row format
524524
engine MySQL define table engine *(defaults to ``InnoDB``)*
525-
collation MySQL define table collation *(defaults to ``utf8mb4_unicode_ci``)*
526525
signed MySQL whether the primary key is ``signed`` *(defaults to ``false``)*
527526
limit MySQL set the maximum length for the primary key
528527
========== ================ ===========

src/Db/Adapter/MysqlAdapter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ public function createTable(Table $table, array $columns = [], array $indexes =
167167
// This method is based on the MySQL docs here: https://dev.mysql.com/doc/refman/5.1/en/create-index.html
168168
$defaultOptions = [
169169
'engine' => 'InnoDB',
170-
'collation' => 'utf8mb4_unicode_ci',
171170
];
172171

173172
$options = array_merge(

0 commit comments

Comments
 (0)