Skip to content

Conversation

@dereuromark
Copy link
Member

@dereuromark dereuromark commented Jan 27, 2026

Summary

  • Remove the hardcoded utf8mb4_unicode_ci default collation from MysqlAdapter::createTable()
  • When no collation is specified, MySQL/MariaDB will now use the database default collation instead
  • Add Migrations.default_collation config option to allow setting a global default collation for all tables
  • Fix duplicate collation entry in docs and update to reflect the new behavior

This avoids collation mismatches on servers with different defaults (e.g. MariaDB 11.8 defaults to utf8mb4_uca1400_ai_ci).

Configuration

// config/app.php
'Migrations' => [
    'default_collation' => null, // null = use database default
    // 'default_collation' => 'utf8mb4_unicode_ci', // explicit override
],

Per-table 'collation' => '...' options still take precedence over the global config.

Fixes #1010

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
Allow configuring a global default collation for MySQL tables via
Configure::read('Migrations.default_collation'). When null (default),
tables inherit the database server collation. Per-table collation
options still take precedence.
@dereuromark dereuromark force-pushed the fix/mysql-default-collation branch from 2056154 to 4b10cb1 Compare January 27, 2026 10:01
@dereuromark dereuromark changed the base branch from 4.x to 5.x January 27, 2026 10:01
@dereuromark dereuromark marked this pull request as ready for review January 27, 2026 10:02
@markstory markstory merged commit e8d7b84 into 5.x Jan 29, 2026
14 checks passed
@markstory markstory deleted the fix/mysql-default-collation branch January 29, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default collation for Mysql

3 participants