#30065: Bug in django migrations
-------------------------------------+-------------------------------------
     Reporter:  ZaArsProgger         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.11
     Severity:  Normal               |               Resolution:
     Keywords:  migration, unique,   |             Triage Stage:
  together, model                    |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by ZaArsProgger:

Old 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',
>         ),

New 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',
         ),
 }}}

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30065#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.af928e21618770a5440bcca9af5a55e2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to