--
Ticket URL: <https://code.djangoproject.com/ticket/23794>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* version: 1.7 => master
* needs_docs: => 0
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted
Comment:
Managed to reproduce against master.
--
Ticket URL: <https://code.djangoproject.com/ticket/23794#comment:1>
* owner: nobody => trg
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/23794#comment:2>
* status: assigned => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/23794#comment:3>
* status: closed => new
* has_patch: 0 => 1
* resolution: fixed =>
Comment:
Pull-request submitted at https://github.com/django/django/pull/3533
--
Ticket URL: <https://code.djangoproject.com/ticket/23794#comment:4>
* cc: info+coding@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/23794#comment:5>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"72729f844e0dd9bd01b3874171b89ab0d136a40e"]:
{{{
#!CommitTicketReference repository=""
revision="72729f844e0dd9bd01b3874171b89ab0d136a40e"
Fixed #23794 -- Fixed migrations crash when removing a field that's part
of index/unique_together.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23794#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"feded19104b14bc28aaccf550265157df84593ba"]:
{{{
#!CommitTicketReference repository=""
revision="feded19104b14bc28aaccf550265157df84593ba"
[1.7.x] Fixed #23794 -- Fixed migrations crash when removing a field
that's part of index/unique_together.
Backport of 72729f844e0dd9bd01b3874171b89ab0d136a40e from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23794#comment:7>
Old description:
> 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.
New description:
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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/23794#comment:8>