Fixed collation tests on MySQL 8.0.30+.

The utf8_ collations are renamed to utf8mb3_* on MySQL 8.0.30+.
This commit is contained in:
Mariusz Felisiak 2022-07-27 21:36:25 +02:00 committed by GitHub
parent 9dff316be4
commit 88dba2e3fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -66,11 +66,14 @@ class DatabaseFeatures(BaseDatabaseFeatures):
@cached_property
def test_collations(self):
charset = "utf8"
if self.connection.mysql_is_mariadb and self.connection.mysql_version >= (
10,
6,
if (
self.connection.mysql_is_mariadb
and self.connection.mysql_version >= (10, 6)
) or (
not self.connection.mysql_is_mariadb
and self.connection.mysql_version >= (8, 0, 30)
):
# utf8 is an alias for utf8mb3 in MariaDB 10.6+.
# utf8 is an alias for utf8mb3 in MariaDB 10.6+ and MySQL 8.0.30+.
charset = "utf8mb3"
return {
"ci": f"{charset}_general_ci",