On 05/31/2013 09:55 AM, Mantas wrote:
Quoting [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
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 [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.