Browse Source

Fixed #34850 -- Dropped support for MariaDB 10.4.

Mariusz Felisiak 1 year ago
parent
commit
3623a0c079

+ 0 - 4
django/db/backends/mysql/base.py

@@ -395,10 +395,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
                 "PositiveIntegerField": "`%(column)s` >= 0",
                 "PositiveIntegerField": "`%(column)s` >= 0",
                 "PositiveSmallIntegerField": "`%(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 check_constraints
         return {}
         return {}
 
 

+ 4 - 23
django/db/backends/mysql/features.py

@@ -66,7 +66,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
     @cached_property
     @cached_property
     def minimum_database_version(self):
     def minimum_database_version(self):
         if self.connection.mysql_is_mariadb:
         if self.connection.mysql_is_mariadb:
-            return (10, 4)
+            return (10, 5)
         else:
         else:
             return (8, 0, 11)
             return (8, 0, 11)
 
 
@@ -120,10 +120,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
             },
             },
         }
         }
         if self.connection.mysql_is_mariadb and (
         if self.connection.mysql_is_mariadb and (
-            10,
+            self.connection.mysql_version < (10, 5, 2)
-            4,
+        ):
-            3,
-        ) < self.connection.mysql_version < (10, 5, 2):
             skips.update(
             skips.update(
                 {
                 {
                     "https://jira.mariadb.org/browse/MDEV-19598": {
                     "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:
         if not self.supports_explain_analyze:
             skips.update(
             skips.update(
                 {
                 {
@@ -209,11 +194,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
 
 
     @cached_property
     @cached_property
     def can_return_columns_from_insert(self):
     def can_return_columns_from_insert(self):
-        return self.connection.mysql_is_mariadb and self.connection.mysql_version >= (
+        return self.connection.mysql_is_mariadb
-            10,
-            5,
-            0,
-        )
 
 
     can_return_rows_from_bulk_insert = property(
     can_return_rows_from_bulk_insert = property(
         operator.attrgetter("can_return_columns_from_insert")
         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
         return "`%s`" % name
 
 
     def return_insert_columns(self, fields):
     def return_insert_columns(self, fields):
-        # MySQL and MariaDB < 10.5.0 don't support an INSERT...RETURNING
+        # MySQL doesn't support an INSERT...RETURNING statement.
-        # statement.
         if not fields:
         if not fields:
             return "", ()
             return "", ()
         columns = [
         columns = [

+ 1 - 1
docs/ref/databases.txt

@@ -387,7 +387,7 @@ non-durable <https://www.postgresql.org/docs/current/non-durability.html>`_.
 MariaDB notes
 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
 To use MariaDB, use the MySQL backend, which is shared between the two. See the
 :ref:`MySQL notes <mysql-notes>` for more details.
 :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.
 * 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
 * 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
   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
+  PostgreSQL, MariaDB, and SQLite 3.35+). On other databases, it will not be
-  be set.
+  set.
 * It does not work with many-to-many relationships.
 * It does not work with many-to-many relationships.
 * It casts ``objs`` to a list, which fully evaluates ``objs`` if it's a
 * 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
   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
 Miscellaneous
 -------------
 -------------
 
 

+ 2 - 2
tests/backends/mysql/tests.py

@@ -106,8 +106,8 @@ class Tests(TestCase):
     @mock.patch.object(connection, "get_database_version")
     @mock.patch.object(connection, "get_database_version")
     def test_check_database_version_supported(self, mocked_get_database_version):
     def test_check_database_version_supported(self, mocked_get_database_version):
         if connection.mysql_is_mariadb:
         if connection.mysql_is_mariadb:
-            mocked_get_database_version.return_value = (10, 3)
+            mocked_get_database_version.return_value = (10, 4)
-            msg = "MariaDB 10.4 or later is required (found 10.3)."
+            msg = "MariaDB 10.5 or later is required (found 10.4)."
         else:
         else:
             mocked_get_database_version.return_value = (8, 0, 4)
             mocked_get_database_version.return_value = (8, 0, 4)
             msg = "MySQL 8.0.11 or later is required (found 8.0.4)."
             msg = "MySQL 8.0.11 or later is required (found 8.0.4)."