Fixed #34850 -- Dropped support for MariaDB 10.4.

This commit is contained in:
Mariusz Felisiak 2023-09-19 15:06:05 +02:00 committed by GitHub
parent 7c1cf585e8
commit 3623a0c079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 34 deletions

View File

@ -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 {}

View File

@ -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")

View File

@ -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 = [

View File

@ -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.

View File

@ -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

View File

@ -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
------------- -------------

View File

@ -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)."