UpdateDatabase/MysqlEngineCharset.php
[Pman.Core] / UpdateDatabase / MysqlEngineCharset.php
index 0cf64ae..5ff5c5a 100644 (file)
@@ -14,8 +14,9 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
     {
           
         $this->loadIniFiles(); //?? shared???
+        $this->updateEngine(); // update the engine first - get's around 1000 character limit on indexes..
+        
         $this->updateCharacterSet();
-        $this->updateEngine();
         
         
     }
@@ -75,6 +76,8 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
             //as the default collation for stored procedure parameters is utf8_general_ci and you can't mix collations.
             
             $ce = DB_DataObject::factory('core_enum');
+            // not sure why, but convert to does not actually change the 'charset=' bit..
+            $ce->query("ALTER TABLE $tbl CHARSET=utf8");
             $ce->query("ALTER TABLE {$tbl} CONVERT TO CHARACTER SET  utf8 COLLATE utf8_general_ci");
             echo "utf8: FIXED {$tbl}\n";
             
@@ -90,12 +93,12 @@ class Pman_Core_UpdateDatabase_MysqlEngineCharset {
             
             $ce = DB_DataObject::factory('core_enum');
             
-            $ce->query("select engine from information_schema.tables where table_schema='hydra' and table_name = 'core_enum'");
+            $ce->query("select engine from information_schema.tables where table_schema='{$ce->database()}' and table_name = '{$tbl}'");
 
             $ce->fetch();
             
             if($ce->engine == 'InnoDB' ){
-                echo "InnoDB: SKIP $tbln";
+                echo "InnoDB: SKIP $tbl\n";
                 continue;
             }
             // this used to be utf8_unicode_ci