]> git.mxchange.org Git - friendica.git/blobdiff - src/Database/DBStructure.php
Merge pull request #8563 from annando/issue-8550
[friendica.git] / src / Database / DBStructure.php
index 06b6524944aa8742bdf6d3c03630a2ccb7cc16e2..dc13bd6566d94228cab5d63205dde2461c2533c1 100644 (file)
@@ -49,7 +49,7 @@ class DBStructure
        private static $definition = [];
 
        /**
-        * Converts all tables from MyISAM to InnoDB
+        * Converts all tables from MyISAM/InnoDB Antelope to InnoDB Barracuda
         */
        public static function convertToInnoDB()
        {
@@ -59,13 +59,19 @@ class DBStructure
                        ['engine' => 'MyISAM', 'table_schema' => DBA::databaseName()]
                );
 
+               $tables = array_merge($tables, DBA::selectToArray(
+                       ['information_schema' => 'tables'],
+                       ['table_name'],
+                       ['engine' => 'InnoDB', 'ROW_FORMAT' => ['COMPACT', 'REDUNDANT'], 'table_schema' => DBA::databaseName()]
+               ));
+
                if (!DBA::isResult($tables)) {
-                       echo DI::l10n()->t('There are no tables on MyISAM.') . "\n";
+                       echo DI::l10n()->t('There are no tables on MyISAM or InnoDB with the Antelope file format.') . "\n";
                        return;
                }
 
                foreach ($tables AS $table) {
-                       $sql = "ALTER TABLE " . DBA::quoteIdentifier($table['table_name']) . " engine=InnoDB;";
+                       $sql = "ALTER TABLE " . DBA::quoteIdentifier($table['table_name']) . " ENGINE=InnoDB ROW_FORMAT=DYNAMIC;";
                        echo $sql . "\n";
 
                        $result = DBA::e($sql);
@@ -106,10 +112,12 @@ class DBStructure
 
                        echo "\n";
                }
+
+               View::printStructure($basePath);
        }
 
        /**
-        * Loads the database structure definition from the config/dbstructure.config.php file.
+        * Loads the database structure definition from the static/dbstructure.config.php file.
         * On first pass, defines DB_UPDATE_VERSION constant.
         *
         * @see static/dbstructure.config.php
@@ -588,6 +596,8 @@ class DBStructure
                        }
                }
 
+               View::create($verbose, $action);
+
                if ($action && !$install) {
                        DI::config()->set('system', 'maintenance', 0);
                        DI::config()->set('system', 'maintenance_reason', '');