开发者

My django tests are not working due to order of south's schema migrations?

When I run

manage.py test myapp

it dies with this error

Creating test database for alias 'default'...
! Error found during real run of migration! Aborting.
_mysql_exceptions.OperationalError: (1005, "Can't create table 
   'test_dom.#sql-49b_1a1' (errno: 150)")

I am using south to handle schema migrations, django 1.3 and mysql.

Note that when I configure the project individually, I do the following in order

  • syncdb
  • migrate app1
  • migrate app2
  • migrate

The last开发者_Python百科 migration applies to all the other apps. If I don't do the migration manually for the first 2 apps; south will crash on me as well.

Any ideas how to solve this ?


do you know that you can define dependencies in south migrations?

http://south.aeracode.org/docs/dependencies.html

If you define the dependencies, a single "manage.py migrate" should work. If not, please post the error message.


Why do a migrate after a syncdb? Surely you have no migration to do after a freshly created db?

Also note the south settings:

SKIP_SOUTH_TESTS = True SOUTH_TESTS_MIGRATE = False

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜