From 3623a0c0798f941da4d951c912b2c9057c1a3fd3 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 19 Sep 2023 15:06:05 +0200 Subject: [PATCH] Fixed #34850 -- Dropped support for MariaDB 10.4. --- django/db/backends/mysql/base.py | 4 ---- django/db/backends/mysql/features.py | 27 ++++---------------------- django/db/backends/mysql/operations.py | 3 +-- docs/ref/databases.txt | 2 +- docs/ref/models/querysets.txt | 4 ++-- docs/releases/5.1.txt | 6 ++++++ tests/backends/mysql/tests.py | 4 ++-- 7 files changed, 16 insertions(+), 34 deletions(-) diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index e2707a9bfdb..f36139881d0 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -395,10 +395,6 @@ class DatabaseWrapper(BaseDatabaseWrapper): "PositiveIntegerField": "`%(column)s` >= 0", "PositiveSmallIntegerField": "`%(column)s` >= 0", } - if self.mysql_is_mariadb and self.mysql_version < (10, 4, 3): - # MariaDB < 10.4.3 doesn't automatically use the JSON_VALID as - # a check constraint. - check_constraints["JSONField"] = "JSON_VALID(`%(column)s`)" return check_constraints return {} diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py index 4d68b2bf3e9..515f4f002c6 100644 --- a/django/db/backends/mysql/features.py +++ b/django/db/backends/mysql/features.py @@ -66,7 +66,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property def minimum_database_version(self): if self.connection.mysql_is_mariadb: - return (10, 4) + return (10, 5) else: return (8, 0, 11) @@ -120,10 +120,8 @@ class DatabaseFeatures(BaseDatabaseFeatures): }, } if self.connection.mysql_is_mariadb and ( - 10, - 4, - 3, - ) < self.connection.mysql_version < (10, 5, 2): + self.connection.mysql_version < (10, 5, 2) + ): skips.update( { "https://jira.mariadb.org/browse/MDEV-19598": { @@ -132,19 +130,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): }, } ) - if self.connection.mysql_is_mariadb and ( - 10, - 4, - 12, - ) < self.connection.mysql_version < (10, 5): - skips.update( - { - "https://jira.mariadb.org/browse/MDEV-22775": { - "schema.tests.SchemaTests." - "test_alter_pk_with_self_referential_field", - }, - } - ) if not self.supports_explain_analyze: skips.update( { @@ -209,11 +194,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property def can_return_columns_from_insert(self): - return self.connection.mysql_is_mariadb and self.connection.mysql_version >= ( - 10, - 5, - 0, - ) + return self.connection.mysql_is_mariadb can_return_rows_from_bulk_insert = property( operator.attrgetter("can_return_columns_from_insert") diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py index 76ca8157656..7fabb0e05ec 100644 --- a/django/db/backends/mysql/operations.py +++ b/django/db/backends/mysql/operations.py @@ -186,8 +186,7 @@ class DatabaseOperations(BaseDatabaseOperations): return "`%s`" % name def return_insert_columns(self, fields): - # MySQL and MariaDB < 10.5.0 don't support an INSERT...RETURNING - # statement. + # MySQL doesn't support an INSERT...RETURNING statement. if not fields: return "", () columns = [ diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index a4c93be0768..62f82974b0a 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -387,7 +387,7 @@ non-durable `_. MariaDB notes ============= -Django supports MariaDB 10.4 and higher. +Django supports MariaDB 10.5 and higher. To use MariaDB, use the MySQL backend, which is shared between the two. See the :ref:`MySQL notes ` for more details. diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 547bd4b4ff2..d2dc088f378 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -2385,8 +2385,8 @@ This has a number of caveats though: * It does not work with child models in a multi-table inheritance scenario. * If the model's primary key is an :class:`~django.db.models.AutoField`, the primary key attribute can only be retrieved on certain databases (currently - PostgreSQL, MariaDB 10.5+, and SQLite 3.35+). On other databases, it will not - be set. + PostgreSQL, MariaDB, and SQLite 3.35+). On other databases, it will not be + set. * It does not work with many-to-many relationships. * It casts ``objs`` to a list, which fully evaluates ``objs`` if it's a generator. The cast allows inspecting all objects so that any objects with a diff --git a/docs/releases/5.1.txt b/docs/releases/5.1.txt index 37868efde13..2232c83d490 100644 --- a/docs/releases/5.1.txt +++ b/docs/releases/5.1.txt @@ -228,6 +228,12 @@ backends. * ... +Dropped support for MariaDB 10.4 +-------------------------------- + +Upstream support for MariaDB 10.4 ends in June 2024. Django 5.1 supports +MariaDB 10.5 and higher. + Miscellaneous ------------- diff --git a/tests/backends/mysql/tests.py b/tests/backends/mysql/tests.py index d652d179ba3..3c95b1b09fa 100644 --- a/tests/backends/mysql/tests.py +++ b/tests/backends/mysql/tests.py @@ -106,8 +106,8 @@ class Tests(TestCase): @mock.patch.object(connection, "get_database_version") def test_check_database_version_supported(self, mocked_get_database_version): if connection.mysql_is_mariadb: - mocked_get_database_version.return_value = (10, 3) - msg = "MariaDB 10.4 or later is required (found 10.3)." + mocked_get_database_version.return_value = (10, 4) + msg = "MariaDB 10.5 or later is required (found 10.4)." else: mocked_get_database_version.return_value = (8, 0, 4) msg = "MySQL 8.0.11 or later is required (found 8.0.4)."