id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc
390,South can't handle circular app dependencies under MySQL with InnoDB,vasili@…,andrew,"In the [http://south.aeracode.org/docs/dependencies.html dependency documentation], one of the two rules mentioned is: ""No circular dependencies (two or more migrations depending on each other)"".

However, Django itself allows circular dependencies between apps:

{{{
#appone/models.py:

from django.db import models

class ThingOne(models.Model):
    name = models.CharField(max_length=20)
    related_to = models.ForeignKey(""apptwo.ThingTwo"")
}}}

{{{
#apptwo/models.py:

from django.db import models

from appone.models import ThingOne

class ThingTwo(models.Model):
    related_to = models.ForeignKey(ThingOne)
}}}

./manage.py syncdb does the right thing in this situation and adds foreign key constraints ''after'' creating both tables.

But if both apps are migrated with south, the migration fails when using innodb, as south tries to add the foreign key constraint for appone before creating apptwo's table.

Although the constraint of not allowing circular dependencies between migrations might make sense in other situations, here it makes south unable to deal with a legal Django model. Executing 'alter table' statements to add constraints at the end of the migration should solve this.",defect,closed,major,0.7,commands,0.6.2,wontfix,,
