]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/mysqlschema.php
Merge remote-tracking branch 'upstream/nightly' into nightly
[quix0rs-gnu-social.git] / lib / mysqlschema.php
index 435ba4e3a95f57f3ca0ba314db4fb483d0ca0b83..9081c0e57807a479fbb1d20ff4c7edd6accdba83 100644 (file)
@@ -58,10 +58,10 @@ class MysqlSchema extends Schema
      * @return Schema the (single) Schema object
      */
 
-    static function get()
+    static function get($conn = null)
     {
         if (empty(self::$_single)) {
-            self::$_single = new Schema();
+            self::$_single = new Schema($conn);
         }
         return self::$_single;
     }
@@ -271,7 +271,7 @@ class MysqlSchema extends Schema
     function endCreateTable($name, array $def)
     {
         $engine = $this->preferredEngine($def);
-        return ") ENGINE=$engine CHARACTER SET utf8 COLLATE utf8_bin";
+        return ") ENGINE=$engine CHARACTER SET utf8mb4 COLLATE utf8mb4_bin";
     }
     
     function preferredEngine($def)
@@ -335,9 +335,10 @@ class MysqlSchema extends Schema
         if (strtolower($oldProps['ENGINE']) != strtolower($engine)) {
             $phrase[] = "ENGINE=$engine";
         }
-        if (strtolower($oldProps['TABLE_COLLATION']) != 'utf8_bin') {
-            $phrase[] = 'DEFAULT CHARSET=utf8';
-            $phrase[] = 'COLLATE=utf8_bin';
+        if (strtolower($oldProps['TABLE_COLLATION']) != 'utf8mb4_bin') {
+            $phrase[] = 'CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin';
+            $phrase[] = 'DEFAULT CHARACTER SET = utf8mb4';
+            $phrase[] = 'DEFAULT COLLATE = utf8mb4_bin';
         }
     }