Browse Source

Fixed #33129 -- Dropped support for MariaDB 10.2.

Mariusz Felisiak 3 years ago
parent
commit
221b2f85fe

+ 4 - 4
django/contrib/gis/db/backends/mysql/introspection.py

@@ -29,10 +29,10 @@ class MySQLIntrospection(DatabaseIntrospection):
         return field_type, field_params
 
     def supports_spatial_index(self, cursor, table_name):
-        # Supported with MyISAM/Aria, or InnoDB on MySQL 5.7.5+/MariaDB 10.2.2+
+        # Supported with MyISAM/Aria, or InnoDB on MySQL 5.7.5+/MariaDB.
         storage_engine = self.get_storage_engine(cursor, table_name)
         if storage_engine == 'InnoDB':
-            return self.connection.mysql_version >= (
-                (10, 2, 2) if self.connection.mysql_is_mariadb else (5, 7, 5)
-            )
+            if self.connection.mysql_is_mariadb:
+                True
+            return self.connection.mysql_version >= (5, 7, 5)
         return storage_engine in ('MyISAM', 'Aria')

+ 0 - 2
django/contrib/gis/db/backends/mysql/operations.py

@@ -70,8 +70,6 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations):
         if self.connection.mysql_is_mariadb:
             unsupported.remove('PointOnSurface')
             unsupported.update({'GeoHash', 'IsValid'})
-            if self.connection.mysql_version < (10, 2, 4):
-                unsupported.add('AsGeoJSON')
         elif self.connection.mysql_version < (5, 7, 5):
             unsupported.update({'AsGeoJSON', 'GeoHash', 'IsValid'})
         return unsupported

+ 2 - 2
django/contrib/gis/db/backends/mysql/schema.py

@@ -16,8 +16,8 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor):
         self.geometry_sql = []
 
     def skip_default(self, field):
-        # Geometry fields are stored as BLOB/TEXT, for which MySQL < 8.0.13 and
-        # MariaDB < 10.2.1 don't support defaults.
+        # Geometry fields are stored as BLOB/TEXT, for which MySQL < 8.0.13
+        # doesn't support defaults.
         if isinstance(field, GeometryField) and not self._supports_limited_data_type_defaults:
             return True
         return super().skip_default(field)

+ 2 - 2
django/db/backends/mysql/base.py

@@ -132,8 +132,8 @@ class DatabaseWrapper(BaseDatabaseWrapper):
     }
 
     # For these data types:
-    # - MySQL < 8.0.13 and MariaDB < 10.2.1 don't accept default values and
-    #   implicitly treat them as nullable
+    # - MySQL < 8.0.13 doesn't accept default values and implicitly treats them
+    #   as nullable
     # - all versions of MySQL and MariaDB don't support full width database
     #   indexes
     _limited_data_types = (

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

@@ -184,7 +184,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
     @cached_property
     def supports_column_check_constraints(self):
         if self.connection.mysql_is_mariadb:
-            return self.connection.mysql_version >= (10, 2, 1)
+            return True
         return self.connection.mysql_version >= (8, 0, 16)
 
     supports_table_check_constraints = property(operator.attrgetter('supports_column_check_constraints'))
@@ -193,7 +193,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
     def can_introspect_check_constraints(self):
         if self.connection.mysql_is_mariadb:
             version = self.connection.mysql_version
-            return (version >= (10, 2, 22) and version < (10, 3)) or version >= (10, 3, 10)
+            return version >= (10, 3, 10)
         return self.connection.mysql_version >= (8, 0, 16)
 
     @cached_property
@@ -205,7 +205,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
     @cached_property
     def has_select_for_update_nowait(self):
         if self.connection.mysql_is_mariadb:
-            return self.connection.mysql_version >= (10, 3, 0)
+            return True
         return self.connection.mysql_version >= (8, 0, 1)
 
     @cached_property
@@ -244,7 +244,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
     @cached_property
     def supports_json_field(self):
         if self.connection.mysql_is_mariadb:
-            return self.connection.mysql_version >= (10, 2, 7)
+            return True
         return self.connection.mysql_version >= (5, 7, 8)
 
     @cached_property

+ 2 - 3
django/db/backends/mysql/schema.py

@@ -77,10 +77,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
 
     @property
     def _supports_limited_data_type_defaults(self):
-        # MariaDB >= 10.2.1 and MySQL >= 8.0.13 supports defaults for BLOB
-        # and TEXT.
+        # MariaDB and MySQL >= 8.0.13 support defaults for BLOB and TEXT.
         if self.connection.mysql_is_mariadb:
-            return self.connection.mysql_version >= (10, 2, 1)
+            return True
         return self.connection.mysql_version >= (8, 0, 13)
 
     def _column_default_sql(self, field):

+ 1 - 1
docs/ref/contrib/gis/db-api.txt

@@ -348,7 +348,7 @@ functions are available on each spatial backend.
 Function                              PostGIS  Oracle         MariaDB      MySQL       SpatiaLite
 ====================================  =======  ============== ============ =========== =================
 :class:`Area`                         X        X              X            X           X
-:class:`AsGeoJSON`                    X        X              X (≥ 10.2.4) X (≥ 5.7.5) X
+:class:`AsGeoJSON`                    X        X              X            X (≥ 5.7.5) X
 :class:`AsGML`                        X        X                                       X
 :class:`AsKML`                        X                                                X
 :class:`AsSVG`                        X                                                X

+ 1 - 1
docs/ref/contrib/gis/functions.txt

@@ -52,7 +52,7 @@ geographic SRSes.
 
 .. class:: AsGeoJSON(expression, bbox=False, crs=False, precision=8, **extra)
 
-*Availability*: MariaDB (≥ 10.2.4), `MySQL
+*Availability*: MariaDB, `MySQL
 <https://dev.mysql.com/doc/refman/en/spatial-geojson-functions.html#function_st-asgeojson>`__ (≥ 5.7.5),
 Oracle, `PostGIS <https://postgis.net/docs/ST_AsGeoJSON.html>`__, SpatiaLite
 

+ 2 - 2
docs/ref/databases.txt

@@ -328,7 +328,7 @@ non-durable <https://www.postgresql.org/docs/current/non-durability.html>`_.
 MariaDB notes
 =============
 
-Django supports MariaDB 10.2 and higher.
+Django supports MariaDB 10.3 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.
@@ -683,7 +683,7 @@ a :exc:`~django.db.NotSupportedError` is raised.
 Option          MariaDB   MySQL
 =============== ========= ==========
 ``SKIP LOCKED`` X (≥10.6) X (≥8.0.1)
-``NOWAIT``      X (≥10.3) X (≥8.0.1)
+``NOWAIT``      X         X (≥8.0.1)
 ``OF``                    X (≥8.0.1)
 ``NO KEY``
 =============== ========= ==========

+ 2 - 3
docs/ref/models/fields.txt

@@ -1196,9 +1196,8 @@ A field for storing JSON encoded data. In Python the data is represented in its
 Python native format: dictionaries, lists, strings, numbers, booleans and
 ``None``.
 
-``JSONField`` is supported on MariaDB 10.2.7+, MySQL 5.7.8+, Oracle,
-PostgreSQL, and SQLite (with the :ref:`JSON1 extension enabled
-<sqlite-json1>`).
+``JSONField`` is supported on MariaDB, MySQL 5.7.8+, Oracle, PostgreSQL, and
+SQLite (with the :ref:`JSON1 extension enabled <sqlite-json1>`).
 
 .. attribute:: JSONField.encoder
 

+ 1 - 1
docs/ref/models/querysets.txt

@@ -1793,7 +1793,7 @@ them::
     <QuerySet [<Person: ...)>, ...]>
 
 The ``postgresql``, ``oracle``, and ``mysql`` database backends support
-``select_for_update()``. However, MariaDB 10.3+ only supports the ``nowait``
+``select_for_update()``. However, MariaDB only supports the ``nowait``
 argument, MariaDB 10.6+ also supports the ``skip_locked`` argument, and MySQL
 8.0.1+ supports the ``nowait``, ``skip_locked``, and ``of`` arguments. The
 ``no_key`` argument is only supported on PostgreSQL.

+ 6 - 0
docs/releases/4.1.txt

@@ -223,6 +223,12 @@ backends.
 
 * ...
 
+Dropped support for MariaDB 10.2
+--------------------------------
+
+Upstream support for MariaDB 10.2 ends in May 2022. Django 4.1 supports MariaDB
+10.3 and higher.
+
 Miscellaneous
 -------------