From acbde0c24dc3bf77a1a1fbe7a4b549b3bd440b11 Mon Sep 17 00:00:00 2001
From: Maxime Rainville <maxime@rainville.me>
Date: Sat, 19 Oct 2024 23:36:26 +1300
Subject: [PATCH] ENH Default DB settings to use 4 bytes to store UTF8
 characters

---
 src/ORM/Connect/MySQLDatabase.php | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

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