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

default backup command and default charset #16762

Open
wants to merge 1 commit into
base: 5.x
Choose a base branch
from

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Feb 24, 2025

Description

When getting the default backup command, use getCharset() to get the default-character-set value so that for MySQL utf8 is normalised to utf8mb4.

Related issues

#16753

@@ -204,7 +204,7 @@ public function getDefaultBackupCommand(?array $ignoreTables = null): string
->addArg('--dump-date')
->addArg('--no-autocommit')
->addArg('--routines')
->addArg('--default-character-set=', Craft::$app->getConfig()->getDb()->charset)
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like ideally we'd want to make \craft\config\DbConfig::$charset protected and add setCharset so this code would work either way?

The only reason why the current method is \craft\config\DbConfig::charset and not \craft\config\DbConfig::setCharset is because of fluent config conventions. So, if we add it, one can just reference the other.

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.

2 participants