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

Recommend Change Default Database Charset / Collation to Laravel 9 Defaults #216

Open
timcortesi opened this issue Jun 16, 2022 · 0 comments
Assignees

Comments

@timcortesi
Copy link
Member

timcortesi commented Jun 16, 2022

I recommend changing the default mysql database config in database.php to the following Laravel 9 Defaults:

            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',

(See lines 55, 56 here: https://github.com/laravel/laravel/blob/9.x/config/database.php)

existing graphene defaults are:

            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',

This is required for 4-byte UTF 8 encoding (which is required for things like certain UTF-8 character sets and certain emojis) whereas mysql defaults will use only 3-bytes for UTF 8.

Notably, we may need to run an additional migration to update the database, table, and column defaults to use 4-byte UTF-8 after this change is made. More info here: https://stackoverflow.com/questions/43003301/changing-laravel-mysql-to-utf8mb4-for-emoji-support-in-existing-database

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

No branches or pull requests

2 participants