1
0
mirror of https://github.com/django/django.git synced 2025-03-25 08:40:45 +00:00

Fixed -- Dropped support for MariaDB 10.5.

This commit is contained in:
Mariusz Felisiak 2025-02-09 12:57:40 +01:00 committed by GitHub
parent 0bac41fc7e
commit 17160819f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 18 additions and 49 deletions
django/db/backends/mysql
docs
tests/backends/mysql

@ -11,6 +11,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
allow_sliced_subqueries_with_in = False
has_select_for_update = True
has_select_for_update_nowait = True
has_select_for_update_skip_locked = True
supports_forward_references = False
supports_regex_backreferencing = False
supports_date_lookup_using_string = False
@ -26,6 +27,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_over_clause = True
supports_frame_range_fixed_distance = True
supports_update_conflicts = True
can_rename_index = True
delete_can_self_reference_subquery = False
create_test_procedure_without_params_sql = """
CREATE PROCEDURE test_procedure ()
@ -65,7 +67,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
@cached_property
def minimum_database_version(self):
if self.connection.mysql_is_mariadb:
return (10, 5)
return (10, 6)
else:
return (8, 0, 11)
@ -105,17 +107,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
"update.tests.AdvancedTests.test_update_ordered_by_m2m_annotation_desc",
},
}
if self.connection.mysql_is_mariadb and (
self.connection.mysql_version < (10, 5, 2)
):
skips.update(
{
"https://jira.mariadb.org/browse/MDEV-19598": {
"schema.tests.SchemaTests."
"test_alter_not_unique_field_to_primary_key",
},
}
)
if not self.supports_explain_analyze:
skips.update(
{
@ -222,12 +213,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
return True
return self.connection.mysql_version >= (8, 0, 16)
@cached_property
def has_select_for_update_skip_locked(self):
if self.connection.mysql_is_mariadb:
return self.connection.mysql_version >= (10, 6)
return True
@cached_property
def has_select_for_update_of(self):
return not self.connection.mysql_is_mariadb
@ -300,12 +285,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
operator.attrgetter("supports_select_intersection")
)
@cached_property
def can_rename_index(self):
if self.connection.mysql_is_mariadb:
return self.connection.mysql_version >= (10, 5, 2)
return True
@cached_property
def supports_expression_defaults(self):
if self.connection.mysql_is_mariadb:

@ -43,15 +43,6 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
return "ALTER TABLE %(table)s DROP CONSTRAINT IF EXISTS %(name)s"
return "ALTER TABLE %(table)s DROP CHECK %(name)s"
@property
def sql_rename_column(self):
is_mariadb = self.connection.mysql_is_mariadb
if is_mariadb and self.connection.mysql_version < (10, 5, 2):
# MariaDB < 10.5.2 doesn't support an
# "ALTER TABLE ... RENAME COLUMN" statement.
return "ALTER TABLE %(table)s CHANGE %(old_column)s %(new_column)s %(type)s"
return super().sql_rename_column
def quote_value(self, value):
self.connection.ensure_connection()
# MySQLdb escapes to string, PyMySQL to bytes.
@ -241,16 +232,10 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
)
def _field_db_check(self, field, field_db_params):
if self.connection.mysql_is_mariadb and self.connection.mysql_version >= (
10,
5,
2,
):
if self.connection.mysql_is_mariadb:
return super()._field_db_check(field, field_db_params)
# On MySQL and MariaDB < 10.5.2 (no support for
# "ALTER TABLE ... RENAME COLUMN" statements), check constraints with
# the column name as it requires explicit recreation when the column is
# renamed.
# On MySQL, check constraints with the column name as it requires
# explicit recreation when the column is renamed.
return field_db_params["check"]
def _rename_field_sql(self, table, old_field, new_field, new_type):

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

@ -259,9 +259,8 @@ Exactly one of ``old_name`` and ``old_fields`` can be provided. ``old_fields``
is an iterable of the strings, often corresponding to fields of
``index_together`` (pre-Django 5.1 option).
On databases that don't support an index renaming statement (SQLite and MariaDB
< 10.5.2), the operation will drop and recreate the index, which can be
expensive.
On databases that don't support an index renaming statement (SQLite), the
operation will drop and recreate the index, which can be expensive.
``AddConstraint``
-----------------

@ -237,6 +237,12 @@ backends.
* ...
Dropped support for MariaDB 10.5
--------------------------------
Upstream support for MariaDB 10.5 ends in June 2025. Django 6.0 supports
MariaDB 10.6 and higher.
Dropped support for Python < 3.12
---------------------------------

@ -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, 4)
msg = "MariaDB 10.5 or later is required (found 10.4)."
mocked_get_database_version.return_value = (10, 5)
msg = "MariaDB 10.6 or later is required (found 10.5)."
else:
mocked_get_database_version.return_value = (8, 0, 4)
msg = "MySQL 8.0.11 or later is required (found 8.0.4)."