Skip to content
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

Database collations #489

Merged
merged 16 commits into from
Mar 2, 2025
Merged

Conversation

RichardAnderson
Copy link
Member

@RichardAnderson RichardAnderson commented Feb 15, 2025

Pulls the collation and charset information from the database on install.
Syncs the charset information to existing DBs
Provides the ability to specify the charset.
Partially implements synching of DBs.

image
image

  • Test with MySQL
  • Test with MariaDB
  • Test with PostgreSQL

image

@RichardAnderson RichardAnderson marked this pull request as draft February 15, 2025 15:10
@RichardAnderson RichardAnderson marked this pull request as ready for review February 15, 2025 15:37
/** @var Database $db */
$db = $service->handler();

$db->syncDatabases(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a rollback mechanism and let the user to retry if this fails

public function getStatusText(): string
{
return match ($this->status) {
DatabaseStatus::READY => 'Ready',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't 😂

@saeedvaziry
Copy link
Member

@RichardAnderson I added some unit tests. they might fail now but it is expected to pass

@slaFFik
Copy link

slaFFik commented Mar 2, 2025

utf8mb3 is being phased out in MySQL, so it's better to switch to utf8mb4 for future compatibility.

Also, iirc emojis can't be stored correctly with utf8mb3, plus there are issues with some Chinese/Japanese/Korean characters.

@saeedvaziry
Copy link
Member

@slaFFik this PR uses utf8mb3 as default choice already.

@RichardAnderson
Copy link
Member Author

utf8mb3 is being phased out in MySQL, so it's better to switch to utf8mb4 for future compatibility.

Also, iirc emojis can't be stored correctly with utf8mb3, plus there are issues with some Chinese/Japanese/Korean characters.

This is true, however, we are attempting to support 3 versions of MySQL, so uft8mb4 is not supported on all of them. I guess for later version we should change the default collation, but at the moment, nothing in the service can identify the version, it's treated generically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants