private function convertTablesToUtf8mb4($tablesToConvert)
{
// Make sure the database driver REALLY has support for converting character sets
if (!method_exists($this->db, 'getAlterTableCharacterSet')) {
return;
}
asort($tablesToConvert);
foreach ($tablesToConvert as $tableName) {
$collation = $this->getTableCollation($tableName);
$parts = explode('_', $collation, 3);
$encoding = empty($parts[0]) ? '' : strtolower($parts[0]);
if ($encoding != 'utf8mb4') {
$queries = $this->db->getAlterTableCharacterSet($tableName);
try {
foreach ($queries as $query) {
$this->db->setQuery($query)->execute();
}
} catch (\Exception $e) {
// We ignore failed conversions. Remember, you MUST change your indices MANUALLY.
}
}
}
}