Skip to content

Commit da4f624

Browse files
committed
AC-9755:Set default collation to utf8mb4 for MySQL
1 parent fcd1daa commit da4f624

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ public function modifyColumn($tableName, $columnName, $definition, $flushData =
12681268
$definition = $this->_getColumnDefinition($definition);
12691269
}
12701270
// Add charset and collation for DBC failures
1271-
if(!empty($definition)) {
1271+
if (!empty($definition)) {
12721272
$type = explode(' ', trim($definition));
12731273
$definition = $this->applyCharsetAndCollation($type[0], $definition, 1);
12741274
}
@@ -2447,7 +2447,7 @@ protected function _getColumnsDefinition(Table $table)
24472447
);
24482448
}
24492449
// Adding charset and collation for DBC failures
2450-
if(count($definition)) {
2450+
if (count($definition)) {
24512451
foreach ($definition as $index => $columnDefinition) {
24522452
$type = explode(' ', trim($columnDefinition));
24532453
$definition[$index] = $this->applyCharsetAndCollation($type[1], $columnDefinition, 2);
@@ -4311,9 +4311,9 @@ public function __debugInfo()
43114311
/***
43124312
* Adding charset and collation for DBC failures
43134313
*
4314-
* @param $columnType
4315-
* @param $definition
4316-
* @param $position
4314+
* @param string $columnType
4315+
* @param string $definition
4316+
* @param int $position
43174317
* @return string
43184318
*/
43194319
private function applyCharsetAndCollation($columnType, $definition, $position) : string

lib/internal/Magento/Framework/Mview/View/Changelog.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/**
1919
* Class Changelog for manipulations with the mview_state table.
20+
*
21+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2022
*/
2123
class Changelog implements ChangelogInterface
2224
{

lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/DbSchemaWriterTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Framework\Setup\Declaration\Schema\Db\StatementFactory;
1616
use Magento\Framework\Setup\Declaration\Schema\DryRunLogger;
1717
use Magento\Framework\Setup\Declaration\Schema\Db\MySQL\DbSchemaWriter;
18+
use Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Table as DtoFactoriesTable;
1819
use PHPUnit\Framework\MockObject\MockObject;
1920
use PHPUnit\Framework\TestCase;
2021

@@ -50,6 +51,11 @@ class DbSchemaWriterTest extends TestCase
5051
*/
5152
private $model;
5253

54+
/***
55+
* @var DtoFactoriesTable|MockObject
56+
*/
57+
private $dtoFactoriesTable;
58+
5359
protected function setUp(): void
5460
{
5561
$this->resourceConnection = $this->getMockBuilder(ResourceConnection::class)
@@ -70,12 +76,16 @@ protected function setUp(): void
7076
$this->resourceConnection->expects($this->any())
7177
->method('getConnection')
7278
->willReturn($this->adapter);
79+
$this->dtoFactoriesTable = $this->getMockBuilder(DtoFactoriesTable::class)
80+
->disableOriginalConstructor()
81+
->getMock();
7382

7483
$this->model = new DbSchemaWriter(
7584
$this->resourceConnection,
7685
$this->statementFactory,
7786
$this->dryRunLogger,
78-
$this->sqlVersionProvider
87+
$this->sqlVersionProvider,
88+
$this->dtoFactoriesTable
7989
);
8090
}
8191

0 commit comments

Comments
 (0)