[1.7.x] Fixed #23719 -- Fixed MySQL 5.6 crash with GeometryFields in migrations.
Backport of 03bd79ed2
from master
This commit is contained in:
parent
d73c7e5db6
commit
bb42bab6d3
|
@ -15,6 +15,13 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor):
|
||||||
super(MySQLGISSchemaEditor, self).__init__(*args, **kwargs)
|
super(MySQLGISSchemaEditor, self).__init__(*args, **kwargs)
|
||||||
self.geometry_sql = []
|
self.geometry_sql = []
|
||||||
|
|
||||||
|
def skip_default(self, field):
|
||||||
|
return (
|
||||||
|
super(MySQLGISSchemaEditor, self).skip_default(field) or
|
||||||
|
# Geometry fields are stored as BLOB/TEXT and can't have defaults.
|
||||||
|
isinstance(field, GeometryField)
|
||||||
|
)
|
||||||
|
|
||||||
def column_sql(self, model, field, include_default=False):
|
def column_sql(self, model, field, include_default=False):
|
||||||
column_sql = super(MySQLGISSchemaEditor, self).column_sql(model, field, include_default)
|
column_sql = super(MySQLGISSchemaEditor, self).column_sql(model, field, include_default)
|
||||||
# MySQL doesn't support spatial indexes on NULL columns
|
# MySQL doesn't support spatial indexes on NULL columns
|
||||||
|
|
|
@ -26,3 +26,6 @@ Bugfixes
|
||||||
:setting:`STATIC_ROOT` has the default ``None`` value (:ticket:`23717`).
|
:setting:`STATIC_ROOT` has the default ``None`` value (:ticket:`23717`).
|
||||||
|
|
||||||
* Added GeoDjango compatibility with mysqlclient database driver.
|
* Added GeoDjango compatibility with mysqlclient database driver.
|
||||||
|
|
||||||
|
* Fixed MySQL 5.6+ crash with ``GeometryField``\s in migrations
|
||||||
|
(:ticket:`23719`).
|
||||||
|
|
Loading…
Reference in New Issue