Skip to content

Commit b080640

Browse files
authored
Merge pull request #159 from ewallah/issue#37
Use utf8mb4 for mysql and mariadb
2 parents 9908a9d + ea94638 commit b080640

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

gha.dist.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
env:
2121
MYSQL_USER: 'root'
2222
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
23+
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
24+
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
25+
2326
ports:
2427
- 3306:3306
2528
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3

src/Installer/Database/MySQLDatabase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function getCreateDatabaseCommand()
2424
$passOpt = !empty($this->pass) ? ' --password='.escapeshellarg($this->pass) : '';
2525
$user = escapeshellarg($this->user);
2626
$host = escapeshellarg($this->host);
27-
$createDB = escapeshellarg(sprintf('CREATE DATABASE `%s` DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;', $this->name));
27+
$createDB = escapeshellarg(sprintf('CREATE DATABASE `%s` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;', $this->name));
2828

2929
return sprintf('mysql -u %s%s -h %s -e %s', $user, $passOpt, $host, $createDB);
3030
}

tests/Installer/Database/MariaDBDatabaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testGetCreateDatabaseCommand()
2424
$database->pass = 'TestPass';
2525
$database->host = 'TestHost';
2626

27-
$expected = 'mysql -u \'TestUser\' --password=\'TestPass\' -h \'TestHost\' -e \'CREATE DATABASE `TestName` DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;\'';
27+
$expected = 'mysql -u \'TestUser\' --password=\'TestPass\' -h \'TestHost\' -e \'CREATE DATABASE `TestName` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\'';
2828
$this->assertSame($expected, $database->getCreateDatabaseCommand());
2929
}
3030
}

tests/Installer/Database/MySQLDatabaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testGetCreateDatabaseCommand()
2424
$database->pass = 'TestPass';
2525
$database->host = 'TestHost';
2626

27-
$expected = 'mysql -u \'TestUser\' --password=\'TestPass\' -h \'TestHost\' -e \'CREATE DATABASE `TestName` DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;\'';
27+
$expected = 'mysql -u \'TestUser\' --password=\'TestPass\' -h \'TestHost\' -e \'CREATE DATABASE `TestName` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\'';
2828
$this->assertSame($expected, $database->getCreateDatabaseCommand());
2929
}
3030
}

0 commit comments

Comments
 (0)