summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-07-08 13:30:12 +0200
committerGitHub <noreply@github.com>2022-07-08 13:30:12 +0200
commiteb3699ea775548a22e0407ad12bf8cbdeaf95ff5 (patch)
treebed4fed56dfc92b6808de048d1c2b6132d064ed4 /django/db
parentccbf714ebeff51d1370789e5e487a978d0e2dbfb (diff)
Fixed #33718 -- Dropped support for MySQL 5.7.
Diffstat (limited to 'django/db')
-rw-r--r--django/db/backends/mysql/features.py56
-rw-r--r--django/db/backends/mysql/operations.py8
2 files changed, 5 insertions, 59 deletions
diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py
index b454618646..db04d42e24 100644
--- a/django/db/backends/mysql/features.py
+++ b/django/db/backends/mysql/features.py
@@ -61,15 +61,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
if self.connection.mysql_is_mariadb:
return (10, 4)
else:
- return (5, 7)
-
- @cached_property
- def bare_select_suffix(self):
- if not self.connection.mysql_is_mariadb and self.connection.mysql_version < (
- 8,
- ):
- return " FROM DUAL"
- return ""
+ return (8,)
@cached_property
def test_collations(self):
@@ -128,27 +120,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
},
}
)
- if not self.connection.mysql_is_mariadb and self.connection.mysql_version < (
- 8,
- ):
- skips.update(
- {
- "Casting to datetime/time is not supported by MySQL < 8.0. "
- "(#30224)": {
- "aggregation.tests.AggregateTestCase."
- "test_aggregation_default_using_time_from_python",
- "aggregation.tests.AggregateTestCase."
- "test_aggregation_default_using_datetime_from_python",
- },
- "MySQL < 8.0 returns string type instead of datetime/time. "
- "(#30224)": {
- "aggregation.tests.AggregateTestCase."
- "test_aggregation_default_using_time_from_database",
- "aggregation.tests.AggregateTestCase."
- "test_aggregation_default_using_datetime_from_database",
- },
- }
- )
if self.connection.mysql_is_mariadb and (
10,
4,
@@ -175,21 +146,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
},
}
)
- if not self.connection.mysql_is_mariadb and self.connection.mysql_version < (
- 8,
- ):
- skips.update(
- {
- "Parenthesized combined queries are not supported on MySQL < 8.": {
- "queries.test_qs_combinators.QuerySetSetOperationTests."
- "test_union_in_subquery",
- "queries.test_qs_combinators.QuerySetSetOperationTests."
- "test_union_in_subquery_related_outerref",
- "queries.test_qs_combinators.QuerySetSetOperationTests."
- "test_union_in_with_ordering",
- }
- }
- )
if not self.supports_explain_analyze:
skips.update(
{
@@ -342,16 +298,10 @@ class DatabaseFeatures(BaseDatabaseFeatures):
return not self.connection.mysql_is_mariadb
@cached_property
- def supports_json_field(self):
- if self.connection.mysql_is_mariadb:
- return True
- return self.connection.mysql_version >= (5, 7, 8)
-
- @cached_property
def can_introspect_json_field(self):
if self.connection.mysql_is_mariadb:
- return self.supports_json_field and self.can_introspect_check_constraints
- return self.supports_json_field
+ return self.can_introspect_check_constraints
+ return True
@cached_property
def supports_index_column_ordering(self):
diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py
index 34cdfc0292..6c0c6ebd2b 100644
--- a/django/db/backends/mysql/operations.py
+++ b/django/db/backends/mysql/operations.py
@@ -389,12 +389,8 @@ class DatabaseOperations(BaseDatabaseOperations):
return prefix
def regex_lookup(self, lookup_type):
- # REGEXP BINARY doesn't work correctly in MySQL 8+ and REGEXP_LIKE
- # doesn't exist in MySQL 5.x or in MariaDB.
- if (
- self.connection.mysql_version < (8, 0, 0)
- or self.connection.mysql_is_mariadb
- ):
+ # REGEXP_LIKE doesn't exist in MariaDB.
+ if self.connection.mysql_is_mariadb:
if lookup_type == "regex":
return "%s REGEXP BINARY %s"
return "%s REGEXP %s"