diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-07-08 13:30:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-08 13:30:12 +0200 |
| commit | eb3699ea775548a22e0407ad12bf8cbdeaf95ff5 (patch) | |
| tree | bed4fed56dfc92b6808de048d1c2b6132d064ed4 /django | |
| parent | ccbf714ebeff51d1370789e5e487a978d0e2dbfb (diff) | |
Fixed #33718 -- Dropped support for MySQL 5.7.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/gis/db/backends/mysql/features.py | 25 | ||||
| -rw-r--r-- | django/contrib/gis/db/backends/mysql/introspection.py | 8 | ||||
| -rw-r--r-- | django/contrib/gis/db/backends/mysql/operations.py | 2 | ||||
| -rw-r--r-- | django/contrib/gis/db/backends/mysql/schema.py | 5 | ||||
| -rw-r--r-- | django/db/backends/mysql/features.py | 56 | ||||
| -rw-r--r-- | django/db/backends/mysql/operations.py | 8 |
6 files changed, 10 insertions, 94 deletions
diff --git a/django/contrib/gis/db/backends/mysql/features.py b/django/contrib/gis/db/backends/mysql/features.py index 8999a38bf9..cd99420374 100644 --- a/django/contrib/gis/db/backends/mysql/features.py +++ b/django/contrib/gis/db/backends/mysql/features.py @@ -4,6 +4,7 @@ from django.utils.functional import cached_property class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): + empty_intersection_returns_none = False has_spatialrefsys_table = False supports_add_srs_entry = False supports_distance_geodetic = False @@ -15,30 +16,6 @@ class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): unsupported_geojson_options = {"crs"} @cached_property - def empty_intersection_returns_none(self): - return ( - not self.connection.mysql_is_mariadb - and self.connection.mysql_version < (5, 7, 5) - ) - - @cached_property def supports_geometry_field_unique_index(self): # Not supported in MySQL since https://dev.mysql.com/worklog/task/?id=11808 return self.connection.mysql_is_mariadb - - @cached_property - def django_test_skips(self): - skips = super().django_test_skips - if not self.connection.mysql_is_mariadb and self.connection.mysql_version < ( - 8, - 0, - 0, - ): - skips.update( - { - "MySQL < 8 gives different results.": { - "gis_tests.geoapp.tests.GeoLookupTest.test_disjoint_lookup", - }, - } - ) - return skips diff --git a/django/contrib/gis/db/backends/mysql/introspection.py b/django/contrib/gis/db/backends/mysql/introspection.py index 7497ad520c..4d6aea78a2 100644 --- a/django/contrib/gis/db/backends/mysql/introspection.py +++ b/django/contrib/gis/db/backends/mysql/introspection.py @@ -28,10 +28,6 @@ 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. + # Supported with MyISAM, Aria, or InnoDB. storage_engine = self.get_storage_engine(cursor, table_name) - if storage_engine == "InnoDB": - if self.connection.mysql_is_mariadb: - return True - return self.connection.mysql_version >= (5, 7, 5) - return storage_engine in ("MyISAM", "Aria") + return storage_engine in ("MyISAM", "Aria", "InnoDB") diff --git a/django/contrib/gis/db/backends/mysql/operations.py b/django/contrib/gis/db/backends/mysql/operations.py index 4ef014b36b..6d04874537 100644 --- a/django/contrib/gis/db/backends/mysql/operations.py +++ b/django/contrib/gis/db/backends/mysql/operations.py @@ -86,8 +86,6 @@ class MySQLOperations(BaseSpatialOperations, DatabaseOperations): if self.connection.mysql_is_mariadb: unsupported.remove("PointOnSurface") unsupported.update({"GeoHash", "IsValid"}) - elif self.connection.mysql_version < (5, 7, 5): - unsupported.update({"AsGeoJSON", "GeoHash", "IsValid"}) return unsupported def geo_db_type(self, f): diff --git a/django/contrib/gis/db/backends/mysql/schema.py b/django/contrib/gis/db/backends/mysql/schema.py index b173df0198..1c9fe0e565 100644 --- a/django/contrib/gis/db/backends/mysql/schema.py +++ b/django/contrib/gis/db/backends/mysql/schema.py @@ -81,8 +81,7 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor): self.execute(sql) except OperationalError: logger.error( - "Cannot create SPATIAL INDEX %s. Only MyISAM and (as of " - "MySQL 5.7.5) InnoDB support them.", - sql, + f"Cannot create SPATIAL INDEX {sql}. Only MyISAM, Aria, and InnoDB " + f"support them.", ) self.geometry_sql = [] 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" |
