#30966: Migration crashes due to foreign key issue, depending on otherwise
irrelevant order on MySQL.
-------------------------------------+-------------------------------------
     Reporter:  Peter Thomassen      |                    Owner:  Hasan
                                     |  Ramezani
         Type:  Bug                  |                   Status:  assigned
    Component:  Migrations           |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  migration mySQL      |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Hasan Ramezani):

 Simon, I checked the `TODO` in `AlterField.state_forwards`, here is my
 understanding.
 When I run the test in my the patch(my patch in
 [https://github.com/django/django/pull/12061 PR] + your patch in
 comment:7) it fails on alter operation in `0002_alter_user_id` at line
 `assert f.remote_field.model._meta.concrete_model._meta.apps is self.apps`

 {{{
 operations = [
         migrations.AlterField(
             model_name="user",
             name="id",
             field=models.CharField(default=uuid.uuid4, max_length=32,
 primary_key=True),
         ),
     ]
 }}}

 It fails because there is an operation in  `0001_initial` which run before
 the above mentioned migration:


 {{{
         migrations.AlterField(
             model_name="RRset",
             name="subname",
             field=models.CharField(blank=False, max_length=178),
         ),

 }}}

 this is an alter migration and the `AlterField.state_forwards` reloads  3
 models of 4 (User, Domain, RRest) and don't reload the Token model.
 If I reload the Token model this test will be passed.


 Should I change the function to find proper models to reload?
 Is it the right solution?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30966#comment:12>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.f6d6a2eccd7b88ebe33423c3cf3a456b%40djangoproject.com.

Reply via email to