-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Define default collation for TiDB tables #22271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment for an improvement. But we could also change that as soon as it is needed though. Otherwise the PR looks good 👍
{ | ||
return $this->getDbSettings()->getEngine(); | ||
} | ||
|
||
protected function getTableRowFormat(): string | ||
{ | ||
return $this->getDbSettings()->getRowFormat(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we maybe fully move the getRowFormat
away from DbSettings
into the Schema
? That way we could also simply leave it away for TiDb in general. Or if ever needed use another one for TiDb if they start adding something around that.
We can address this separately if needed, I'll merge this now so that we can run rebase and another set of tests for TiDB. |
* Define consistent db settings access * Define reusable table creation options * Create all tables with explicit row format * Define default collation for TiDB tables * Use table create options from schema in migrations * Create TiDB databases with default collation * Update OmniFixture dump to include ROW_FORMAT
Description:
TiDB uses
utf8mb4_general_bin
as the default collation when creating a table. Compared to the MySQL default ofutf8mb4_general_ci
the sorting of some database results will be different.This PR changes the table/database creation code to be more consistent across engines and actions:
Always define
ROW_FORMAT=dynamic
Previously, the row format was only defined for tables created during a migration.
For InnoDB, all tables currently should default to
ROW_FORMAT=DYNAMIC
, adding it to all tables by default should (as far as I know) not be an issue.Note: TiDB currently ignores the
ROW_FORMAT
and always usesCOMPACT
(docs).Set a default collation for TiDB tables
When TiDB is configured, and the (default)
utf8mb4
charset is used, all created tables will be created with a matchingCOLLATE=utf8mb4_0900_ai_ci
.Set a default collation for TiDB databases
Creating a database also sets the default collation if TiDB is configured.
Refs DEV-18061
Review