#22485: makemigrations fails with dependencies to unmigrated apps
-------------------------------------+-------------------------------------
     Reporter:  apollo13             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Migrations           |                  Version:  master
     Severity:  Release blocker      |               Resolution:  fixed
     Keywords:  migrations,          |             Triage Stage:  Accepted
  unmigrated, makemigrations         |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by rodutSD):

 This seems like the closest topic.

 I am seeing, what I believe to be, this bug in 1.7b4.  It is not
 contenttype, logEntry, or user related.  It doesn't appear to be dangling
 lookup related either.   I have not manually tried the patch referenced
 above because I assuming that it is merged into the recent 1.7b4 release.
 (probably dumb)

 migrate is failing for a foreign key to a class of my creation.  The
 migration fails with this error:

 {{{
 File "/Users/xxx/.virtualenvs/DjangoProject/lib/python2.7/site-
 packages/django/db/migrations/state.py", line 86, in render
     model=lookup_model,
 ValueError: Lookup failed for model referenced by field
 Custom_Class.thing.transaction: Another_Custom_Class.transaction
 }}}

 makemigrations runs fine.  It creates the following dependency list which
 is where the problem is:

 {{{
     dependencies = [
         ('Another_Custom_Class', '__first__'),
         ('Custom_Class', '0005_mesh'),
     ]
 }}}

 Running migrate on this fails as above saying my reference to
 Another_Custom_Class.transaction from Custom_Class.thing because it can't
 find it.

 I changed the dependency to the following and it works:

 {{{
     dependencies = [
         ('Another_Custom_Class', '0003_transaction'),
         ('Custom_Class', '0005_mesh'),
     ]
 }}}

 I don't know how all the internals work, but it seems like it wasn't able
 to find the other migration because of what is going on when "_first_" is
 used.

 This problem has happened a bunch of separate times and changing _first_
 to the name of a valid migration seems to fix it.  I just hate having to
 dig in and fix it every time.

 Let me know if anyone needs more details.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22485#comment:39>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.cd24d953c6936c91b66da845b5be204a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to