EscherLabs / Graphene

Graphene is a fully featured Workflow, Micro Application, and Content Management Platform with a robust web-based IDE (Integrated Development Environment). Graphene is the primary engine behind Binghamton University's myBinghamton portal.
https://docs.escherlabs.com/Graphene/
MIT License
29 stars 10 forks source link

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

Open timcortesi opened 2 years ago

timcortesi commented 2 years ago

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