﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22035	makemigrations when adding field with a unique_together constraint should create fields before constraints	Chris Beaven	Anton Baklanov	"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? "	Bug	closed	Migrations	dev	Normal	fixed		antonbaklanov@…	Accepted	1	0	0	0	0	0
