소스 검색

Fixed #34850 -- Dropped support for MariaDB 10.4.

Mariusz Felisiak 1 년 전
부모
커밋
3623a0c079

+ 0 - 4
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 {}
 

+ 4 - 23
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")

+ 1 - 2
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 = [

+ 1 - 1
docs/ref/databases.txt

@@ -387,7 +387,7 @@ non-durable <https://www.postgresql.org/docs/current/non-durability.html>`_.
 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 <mysql-notes>` for more details.

+ 2 - 2
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

+ 6 - 0
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
 -------------
 

+ 2 - 2
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)."