#23719: GIS test failure with MySQL 5.6: BLOB/TEXT column can't have a default
value
---------------------------+-------------------------------------
     Reporter:  timgraham  |                    Owner:  timgraham
         Type:  Bug        |                   Status:  assigned
    Component:  GIS        |                  Version:  1.7
     Severity:  Normal     |               Resolution:
     Keywords:             |             Triage Stage:  Accepted
    Has patch:  0          |      Needs documentation:  0
  Needs tests:  0          |  Patch needs improvement:  0
Easy pickings:  0          |                    UI/UX:  0
---------------------------+-------------------------------------

Comment (by claudep):

 As I can see, the problem is not due to the add field instruction, but
 with the following {{{ALTER TABLE `gis_neighborhood` ALTER COLUMN `path`
 DROP DEFAULT'}}}, while the add field didn't set any default.
 Applying this might help:
 {{{#!diff
 diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py
 index 282dfe6..9d5ebef 100644
 --- a/django/db/backends/schema.py
 +++ b/django/db/backends/schema.py
 @@ -3,6 +3,7 @@ import operator

  from django.db.backends.creation import BaseDatabaseCreation
  from django.db.backends.utils import truncate_name
 +from django.db.models.fields import NOT_PROVIDED
  from django.db.models.fields.related import ManyToManyField
  from django.db.transaction import atomic
  from django.utils.encoding import force_bytes
 @@ -379,7 +380,7 @@ class BaseDatabaseSchemaEditor(object):
          self.execute(sql, params)
          # Drop the default if we need to
          # (Django usually does not use in-database defaults)
 -        if not self.skip_default(field) and field.default is not None:
 +        if not self.skip_default(field) and field.default is not in
 (None, NOT_PROVIDED):
              sql = self.sql_alter_column % {
                  "table": self.quote_name(model._meta.db_table),
                  "changes": self.sql_alter_column_no_default % {
 }}}

 #23581 might be related.

--
Ticket URL: <https://code.djangoproject.com/ticket/23719#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.8fa12696b85e28cb149581d276250640%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to