diff options
| author | Tim Graham <timograham@gmail.com> | 2014-10-28 08:10:45 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-10-29 08:25:59 -0400 |
| commit | bb42bab6d32aab3344b809e49c696a83d45a2954 (patch) | |
| tree | cdc1cafe81c5b1b805d6e61bc8c2cb7837463eb9 /django | |
| parent | d73c7e5db66b7c149db59e07bc4c6253629cf907 (diff) | |
[1.7.x] Fixed #23719 -- Fixed MySQL 5.6 crash with GeometryFields in migrations.
Backport of 03bd79ed2 from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/gis/db/backends/mysql/schema.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/django/contrib/gis/db/backends/mysql/schema.py b/django/contrib/gis/db/backends/mysql/schema.py index 3979182c19..4d708686ba 100644 --- a/django/contrib/gis/db/backends/mysql/schema.py +++ b/django/contrib/gis/db/backends/mysql/schema.py @@ -15,6 +15,13 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor): super(MySQLGISSchemaEditor, self).__init__(*args, **kwargs) 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): column_sql = super(MySQLGISSchemaEditor, self).column_sql(model, field, include_default) # MySQL doesn't support spatial indexes on NULL columns |
