Skip to content

Commit cb7fbac

Browse files
committed
[3.2.x] Fixed collation tests on MySQL 8.0.30+.
The utf8_ collations are renamed to utf8mb3_* on MySQL 8.0.30+. Backport of 88dba2e from main.
1 parent 840d009 commit cb7fbac

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

django/db/backends/mysql/features.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,15 @@ class DatabaseFeatures(BaseDatabaseFeatures):
5151
@cached_property
5252
def test_collations(self):
5353
charset = 'utf8'
54-
if self.connection.mysql_is_mariadb and self.connection.mysql_version >= (10, 6):
55-
# utf8 is an alias for utf8mb3 in MariaDB 10.6+.
56-
charset = 'utf8mb3'
54+
if (
55+
self.connection.mysql_is_mariadb
56+
and self.connection.mysql_version >= (10, 6)
57+
) or (
58+
not self.connection.mysql_is_mariadb
59+
and self.connection.mysql_version >= (8, 0, 30)
60+
):
61+
# utf8 is an alias for utf8mb3 in MariaDB 10.6+ and MySQL 8.0.30+.
62+
charset = "utf8mb3"
5763
return {
5864
'ci': f'{charset}_general_ci',
5965
'non_default': f'{charset}_esperanto_ci',

0 commit comments

Comments
 (0)