diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-07-27 21:36:25 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-08-01 09:25:36 +0200 |
| commit | bdff4d5b3abf5ed84aa129df50409678e0926d11 (patch) | |
| tree | bb4c56e755584cce7204db7363441714406c6a30 | |
| parent | 70bd1d4f7a8dde03f4aaa9a43427b5695ede3132 (diff) | |
[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
| -rw-r--r-- | django/db/backends/mysql/features.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py index d6009a99fa..10e40f956a 100644 --- a/django/db/backends/mysql/features.py +++ b/django/db/backends/mysql/features.py @@ -70,11 +70,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", |
