Opened 6 years ago

Closed 6 years ago

#28366 closed Bug (duplicate)

AlterUniqueTogether and RemoveField on same field lead to migration error

Reported by: Rhaskaas Owned by: nobody
Component: Migrations Version: 1.11
Severity: Normal Keywords: AlterUniqueTogether RemoveField migrate makemigrations
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Consider a model with a field who's used in unique_together.
You want to remove this field and so change the uniquet_together Meta at the same time (in

When you do this and apply "makemigrations", the resulting migration file is not usable.
Indeed, "migrations.RemoveField" is use "before migrations.AlterUniqueTogether" and lead to "django.core.exceptions.FieldDoesNotExist" error.
If you change order manualy in migration file (i.e. alter first and remove after) there is no more problem.

Change History (1)

comment:1 Changed 6 years ago by Tim Graham

Resolution: duplicate
Status: newclosed

Looks like a duplicate of #26180.

Note: See TracTickets for help on using tickets.
Back to Top