Commit ec9aa27b authored by Vincent Petry's avatar Vincent Petry Committed by Thomas Müller
Browse files

Set ROW_FORMAT before setting collation to mb4

parent e19e445f
......@@ -54,7 +54,7 @@ class Collation implements IRepairStep {
*/
public function run(IOutput $output) {
if (!$this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
$output->info('Not a mysql database -> nothing to no');
$output->info('Not a mysql database -> nothing to do');
return;
}
......@@ -63,9 +63,17 @@ class Collation implements IRepairStep {
$tables = $this->getAllNonUTF8BinTables($this->connection);
foreach ($tables as $table) {
$output->info("Change collation for $table ...");
if ($characterSet === 'utf8mb4') {
// need to set row compression first
$query = $this->connection->prepare('ALTER TABLE `' . $table . '` ROW_FORMAT=COMPRESSED;');
$query->execute();
}
$query = $this->connection->prepare('ALTER TABLE `' . $table . '` CONVERT TO CHARACTER SET ' . $characterSet . ' COLLATE ' . $characterSet . '_bin;');
$query->execute();
}
if (empty($tables)) {
$output->info('All tables already have the correct collation -> nothing to do');
}
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment