#23738: Migrations broken with django 1.7.1 when changing null from true to 
false.
---------------------------------+------------------------------------
     Reporter:  niwibe           |                    Owner:  MarkusH
         Type:  Bug              |                   Status:  assigned
    Component:  Migrations       |                  Version:  1.7
     Severity:  Release blocker  |               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 MarkusH):

 As long as you don't have a high traffic site, you should get it working
 with the following workaround:

 {{{#!python
 class Migration(migrations.Migration):
     dependencies = [
         # your dependencies here
     ]

     operations = [
         migrations.AlterField(
             model_name='mymodel',
             name='myfield',
             field=models.IntegerField(null=True, blank=True,
 default=None),
         ),
         migrations.AlterField(
             model_name='mymodel',
             name='myfield',
             field=models.IntegerField(default=0),
         ),
     ]
 }}}

 What happened: Unfortunately I didn't took into account in the other patch
 that the default sticks between a NULL and NOT NULL change :-/. Thus
 changing the default from e.g. `0` to `NULL` while sticking to the NULL
 constraint and changing it back to 0 together with adding the NOT NULL
 constraint should work.

--
Ticket URL: <https://code.djangoproject.com/ticket/23738#comment:9>
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/064.19f03efb711c34fa49268a12357d0e76%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to