Merge pull request #11431 from maxime-rainville/pulls/6/remove-legacy-charset-setting

ENH Default DB settings to use 4 bytes to store UTF8 characters
This commit is contained in:
Guy Sartorelli 2024-10-21 10:54:26 +13:00 committed by GitHub
commit 8845794012
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,6 @@ use SilverStripe\Model\List\PaginatedList;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\Model\List\ArrayList; use SilverStripe\Model\List\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\Queries\SQLSelect;
use Exception; use Exception;
/** /**
@ -31,7 +30,7 @@ class MySQLDatabase extends Database implements TransactionManager
* @config * @config
* @var String * @var String
*/ */
private static $connection_charset = 'utf8'; private static $connection_charset = 'utf8mb4';
/** /**
* Default connection collation * Default connection collation
@ -39,7 +38,7 @@ class MySQLDatabase extends Database implements TransactionManager
* @config * @config
* @var string * @var string
*/ */
private static $connection_collation = 'utf8_general_ci'; private static $connection_collation = 'utf8mb4_unicode_ci';
/** /**
* Default charset * Default charset
@ -47,7 +46,7 @@ class MySQLDatabase extends Database implements TransactionManager
* @config * @config
* @var string * @var string
*/ */
private static $charset = 'utf8'; private static $charset = 'utf8mb4';
/** /**
* SQL Mode used on connections to MySQL. Defaults to ANSI. For basic ORM * SQL Mode used on connections to MySQL. Defaults to ANSI. For basic ORM
@ -73,7 +72,7 @@ class MySQLDatabase extends Database implements TransactionManager
* @config * @config
* @var string * @var string
*/ */
private static $collation = 'utf8_general_ci'; private static $collation = 'utf8mb4_unicode_ci';
public function connect($parameters) public function connect($parameters)
{ {