1
0
mirror of https://github.com/django/django.git synced 2025-06-08 04:59:13 +00:00

[4.1.x] Fixed collation tests on MySQL 8.0.30+.

The utf8_ collations are renamed to utf8mb3_* on MySQL 8.0.30+.
Backport of 88dba2e3fd64b64bcf4fae83b256b4f6f492558f from main
This commit is contained in:
Mariusz Felisiak 2022-07-27 21:36:25 +02:00
parent 70bd1d4f7a
commit bdff4d5b3a

View File

@ -70,11 +70,14 @@ class DatabaseFeatures(BaseDatabaseFeatures):
@cached_property @cached_property
def test_collations(self): def test_collations(self):
charset = "utf8" charset = "utf8"
if self.connection.mysql_is_mariadb and self.connection.mysql_version >= ( if (
10, self.connection.mysql_is_mariadb
6, 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" charset = "utf8mb3"
return { return {
"ci": f"{charset}_general_ci", "ci": f"{charset}_general_ci",