It's worth pointing out that the migration system does try to solve
circular references itself using this same strategy - we have a pretty
extensive set of tests that make sure the autodetector splits apart
circular reference cycles in a variety of situations. The only case where
it's known to fail is swappable models (so AUTH_USER_MODEL), as we can't
predict the value of it.

Andrew

On Thu, Oct 16, 2014 at 5:15 PM, Shai Berger <[email protected]> wrote:

> Hi Uri,
>
> On Friday 17 October 2014 01:30:10 Uri P wrote:
> > Thanks Andrew for enlightening me. That was helpful.
> >
> > Anyway, for me personally, data migration is the easiest part, I can do
> it
> > in a heartbeat by a simple script.
> > In contrary, solving circular dependencies seems to be very difficult in
> my
> > case, especially in light of the currently still limited amount of
> > documentation on the issue...
> >
> You've said that the circular dependencies are "enabled" by lazy loading,
> which implies that the references are more-or-less regular foreign keys
> (not,
> for example, the implicit one-to-one key generated for multi-table
> inheritance). In that case, breaking the circular dependency is not hard:
> comment out one of the offending FKs (so there is no longer a circular
> dependency), run makemigrations, un-comment it, and run makemigrations
> again.
> You will get, for the app where you did it, two migrations -- one creating
> the
> model without the FK, and one adding it, with all the dependencies
> automatically set up.
>
> It may be useful to add something like this to the migrations
> documentation,
> although I suspect there wll always be cases left uncovered, and solving
> such
> problems in general will ultimately require one to "know the ins and outs
> of
> the new migration system".
>
> HTH,
>
>         Shai.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers  (Contributions to Django itself)" 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].
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/201410170315.11295.shai%40platonix.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFwN1uo_WfmLmQtY%3D4n1%2BWx2Wm-Tu3%3DFndr2a%3DdOnUgDAfSCAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to