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 23794 FieldDoesNotExist error in migration with deleted fields and unique_together constraint Nico Benitez Andrzej Pragacz "I had a model that had a ForeignKey field and a unique_together constraint involving that field. I deleted both the field and the unique_together constraint in my model and ran makemigrations. The migration created RemoveField operation and a AlterUniqueTogether operation with unique_together=set([]). When I tried to run the migration, a django.db.models.fields.FieldDoesNotExist exception occured. I edited the migration manually to put the AlterUniqueTogether operation before the RemoveField operation and then the migration worked. NOTE: After upgrading, you must remove the bad migration file and re-run `makemigrations` or manually move the `AlterUniqueTogether` operation manually as stated above; i.e. upgrading does not fix the existing migration." Bug closed Migrations dev Normal fixed migration unique_together removefield info+coding@… Accepted 1 0 0 0 0 0