#22035: makemigrations when adding field with a unique_together constraint 
should
create fields before constraints
-----------------------------+-------------------------
     Reporter:  SmileyChris  |      Owner:
         Type:  Bug          |     Status:  new
    Component:  Migrations   |    Version:  1.7-alpha-1
     Severity:  Normal       |   Keywords:
 Triage Stage:  Unreviewed   |  Has patch:  0
Easy pickings:  0            |      UI/UX:  0
-----------------------------+-------------------------
 Added a slug field to a Tag model, and a unique_together constraint of
 [('site', 'slug')]

 Running makemigrations resulted in a migration with the operations ordered
 like this:

 {{{
     operations = [
         migrations.AlterUniqueTogether(
             name='tag',
             unique_together=set([(u'site', u'slug')]),
         ),
         migrations.AddField(
             model_name='tag',
             name='slug',
             field=models.SlugField(default=''),
             preserve_default=False,
         ),
         migrations.AlterField(
             model_name='tag',
             name='name',
             field=models.CharField(max_length=20),
         ),
     ]
 }}}

 That choked when running the migration, but manually changing the
 constraint to happen after the field addition worked fine. Apart from the
 fact that I should probably have made this two migrations, would it be
 sensible to order the AlterUniqueTogether operations last?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22035>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.70fb78ff7431d8955014eeb6ed70dc09%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to