gpt4 book ai didi

python - Django 的 south(迁移工具)是否适用于 innodb?

转载 作者:太空狗 更新时间:2023-10-30 00:46:46 27 4
gpt4 key购买 nike

$ py manage.py  migrate turkey
Running migrations for turkey:
- Migrating forwards to 0001_initial.
> turkey:0001_initial
! Error found during real run of migration! Aborting.

! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.

! You *might* be able to recover with: = DROP TABLE `turkey_demorecs` CASCADE; []

! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS.
! NOTE: The error which caused the migration to fail is further up.

出于某种原因,我在尝试时得到了这个。但我的其他设置在 MyISAM 中。

为什么它在 Innodb 中不起作用?

最佳答案

InnoDB 对外键有限制,确保您在进行迁移时不会破坏数据库模型。 (参见 http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html)

MyISAM 没有对约束的原生支持(尽管如果你选择做 http://dev.mysql.com/tech-resources/articles/mysql-enforcing-foreign-keys.html 似乎你可以实现它)

因为 MyISAM 没有检查您的 FK 关系,所以您不会收到错误。然而,InnoDB 正在进行检查,您的迁移似乎有问题。

关于python - Django 的 south(迁移工具)是否适用于 innodb?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4834415/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com