Opened 5 years ago

Last modified 5 years ago

#30065 closed Bug

Bug in django migrations — at Initial Version

Reported by: ZaArsProgger Owned by: nobody
Component: Migrations Version: 1.11
Severity: Normal Keywords: migration, unique, together, model
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I found bug in migrations.

I had Model2 with FK to other Model1 and unique_key (model1, ...)
Then I changed Model2 - removed FK to Model1, created FK to Model3 and changed unique_key on (model3, ...)

It resulted as follows:

migrations.RemoveField(

model_name='model1',
name='model1',

),
migrations.AlterUniqueTogether(

name='model1',
unique_together=set([('model3', 'day', 'comment')]),

),

Applying migrations raised django.core.exceptions.FieldDoesNotExist

It was corrected when I interchanged operations

migrations.AlterUniqueTogether(

name='model1',
unique_together=set([('model3', 'day', 'comment')]),

),
migrations.RemoveField(

model_name='model1',
name='model1',

),

Change History (0)

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