That's the nasty edge case - currently it just fails, in the new system
it'll generate three migrations (add A with no FK; add B with FK; add FK to
A). As for the previous post, the syncdb-like step will always run before
the migration step; thus, dependencies are allowed from a migrated to a
non-migrated app, but not vice-versa.

Andrew


On Fri, May 31, 2013 at 8:22 AM, Anssi Kääriäinen
<[email protected]>wrote:

> On 05/31/2013 09:55 AM, Mantas wrote:
>
>> Quoting 
>> django-developers@**googlegroups.com<[email protected]>(2013-05-31
>>  07:39:24)
>>
>>> From: Andrew Godwin <[email protected]>
>>> Date: May 30 07:03PM +0100
>>> Url: http://groups.google.com/**group/django-developers/msg/**
>>> 137ab14f361fd052<http://groups.google.com/group/django-developers/msg/137ab14f361fd052>
>>>
>>> 2. Leave syncdb as it is, like South does, and have everything happen
>>> through a "migrate" command. Leads to weird interactions where each
>>> command
>>> knows about the other, and must be run in a certain order, but which
>>> isn't
>>> immediately obvious.
>>>
>> Order in which syncdb and migrate should be run also depends on
>> dependencies between apps.
>>
>> For example, if you have two apps, A and B:
>>
>>      # A/models.py
>>
>>      class A(models.Model):
>>          name = models.CharField(max_length=**128)
>>
>>
>>      # B/models.py
>>
>>      class B(models.Model):
>>          name = models.CharField(max_length=**128)
>>          aref = models.ForeignKey(A)
>>
>> Then, first you must run syncdb/migrations for A app, and *only* then
>> for app B.
>>
>> So to fully fix migrations, Django should be aware about dependencies
>> between apps, which is very important not only for migrations.
>>
>
> Good point. How does this work with migrations:
>
> app_a:
>   class A(models.Model):
>     b = models.ForeignKey("app_b.b")
>
> app_b:
>   class B(models.Model):
>     a = models.ForeignKey("app_a.a")
>
> In this case you can't have self-contained migrations for app_a and app_b
> separately if you want to run first app_a's migrations, then app_b's (or
> vice versa).
>
>  - Anssi
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> django-developers+unsubscribe@**googlegroups.com<django-developers%[email protected]>
> .
> To post to this group, send email to 
> django-developers@**googlegroups.com<[email protected]>
> .
> Visit this group at http://groups.google.com/**
> group/django-developers?hl=en<http://groups.google.com/group/django-developers?hl=en>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to