UpdateDatabase/MysqlLinks.php
authorAlan Knowles <alan@roojs.com>
Wed, 6 Jan 2016 05:59:47 +0000 (13:59 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 6 Jan 2016 05:59:47 +0000 (13:59 +0800)
UpdateDatabase/MysqlLinks.php

index 36ea2fe..4af23dc 100644 (file)
@@ -49,6 +49,7 @@ class Pman_Core_UpdateDatabase_MysqlLinks {
         $this->updateTableComments();
         
         $this->updateCharacterSet();
+        $this->updateEngine();
         
         $ff = HTML_FlexyFramework::get();
         if (!empty($ff->Pman['enable_trigger_tests'])) {
@@ -487,6 +488,33 @@ class Pman_Core_UpdateDatabase_MysqlLinks {
             
         }
     }
+    function updateEngine()
+    {
+        foreach (array_keys($this->schema) as $tbl){
+            
+            if(strpos($tbl, '__keys') !== false ){
+                continue;
+            }
+            
+            $ce = DB_DataObject::factory('core_enum');
+            
+            $ce->query("select engine from information_schema.tables where table_schema='hydra' and table_name = 'core_enum'");
+
+            $ce->fetch();
+            
+            if($ce->engine == 'InnoDB' ){
+                echo "SKIP engine on $tbl - already InnoDB\n";
+                continue;
+            }
+            // this used to be utf8_unicode_ci
+            //as the default collation for stored procedure parameters is utf8_general_ci and you can't mix collations.
+            
+            $ce = DB_DataObject::factory('core_enum');
+            $ce->query("ALTER TABLE $tbl ENGINE=InnoDB");
+            echo "FIXED engine on {$tbl}\n";
+            
+        }
+    }
     
 }