Skip to content

Commit 0ed80d1

Browse files
committed
AC-9755:Set default collation to utf8mb4 for MySQL
1 parent c441b38 commit 0ed80d1

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ public function modifyColumn($tableName, $columnName, $definition, $flushData =
12671267
if (is_array($definition)) {
12681268
$definition = $this->_getColumnDefinition($definition);
12691269
}
1270-
// Add charset and collation for DBC failures
1270+
// Set default collation to utf8mb4 for MySQL
12711271
if (!empty($definition)) {
12721272
$type = explode(' ', trim($definition));
12731273
$definition = $this->setDefaultCharsetAndCollation($type[0], $definition, 1);
@@ -2446,7 +2446,7 @@ protected function _getColumnsDefinition(Table $table)
24462446
$columnDefinition
24472447
);
24482448
}
2449-
// Adding charset and collation for DBC failures
2449+
// Set default collation to utf8mb4 for MySQL
24502450
if (count($definition)) {
24512451
foreach ($definition as $index => $columnDefinition) {
24522452
$type = explode(' ', trim($columnDefinition));
@@ -4309,7 +4309,7 @@ public function __debugInfo()
43094309
}
43104310

43114311
/***
4312-
* Set default collation & charset (e.g.,utf8mb4_general_ci & utf8mb4) for tables
4312+
* Set default collation & charset (e.g.utf8mb4_general_ci and utf8mb4) for tables
43134313
*
43144314
* @param string $columnType
43154315
* @param string $definition

lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaWriter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,8 @@ private function getPreparedStatements(array $statementBank) : array
482482
return $result;
483483
}
484484

485-
/***
486-
* Set default collation & charset (e.g.,utf8mb4_general_ci & utf8mb4) for tables
485+
/**
486+
* Set default collation & charset (e.g. utf8mb4_general_ci and utf8mb4) for tables
487487
*
488488
* @param string $columnDefinition
489489
* @return string
@@ -498,7 +498,7 @@ private function setDefaultCharsetAndCollation(string $columnDefinition): string
498498
return implode(" ", $columnsAttribute);
499499
}
500500

501-
/***
501+
/**
502502
* Checks if any column of type varchar,char or text (mediumtext/longtext)
503503
*
504504
* @param string $definition

setup/src/Magento/Setup/Model/Installer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ private function setupModuleRegistry(SchemaSetupInterface $setup)
660660
)->setComment('Module versions registry');
661661
$connection->createTable($table);
662662
} else {
663-
// change the charset to utf8mb4
663+
// Set default collation to utf8mb4 for MySQL
664664
$getTableSchema = $connection->getCreateTable($setup->getTable('setup_module')) ?? '';
665665
if (preg_match('/\b('. self::OLDCHARSET .')\b/', $getTableSchema)) {
666666
$tableName = $setup->getTable('setup_module');
@@ -729,7 +729,7 @@ private function setupSessionTable(
729729
);
730730
$connection->createTable($table);
731731
} else {
732-
// change the charset to utf8mb4
732+
// Set default collation to utf8mb4 for MySQL
733733
$getTableSchema = $connection->getCreateTable($setup->getTable('session')) ?? '';
734734
if (preg_match('/\b('. self::OLDCHARSET .')\b/', $getTableSchema)) {
735735
$tableName = $setup->getTable('session');
@@ -837,7 +837,7 @@ private function setupCacheTagTable(
837837
);
838838
$connection->createTable($table);
839839
} else {
840-
// change the charset to utf8mb4
840+
// Set default collation to utf8mb4 for MySQL
841841
$getTableSchema = $connection->getCreateTable($setup->getTable('cache_tag')) ?? '';
842842
if (preg_match('/\b('. self::OLDCHARSET .')\b/', $getTableSchema)) {
843843
$tableName = $setup->getTable('cache_tag');
@@ -1884,7 +1884,7 @@ private function reindexAll(): void
18841884
}
18851885

18861886
/**
1887-
* Set default collation & charset (e.g.,utf8mb4_general_ci & utf8mb4) for core setup tables
1887+
* Set default collation & charset (e.g. utf8mb4_general_ci and utf8mb4) for core setup tables
18881888
*
18891889
* @param string $tableName
18901890
* @param array $columns

0 commit comments

Comments
 (0)