SOUTH 和 django 迁移出现错误
我在 django 中迁移 Sentry 应用程序时遇到此错误。我正在使用 mysql
! 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 `sentry_groupedmessage` CASCADE; []
= DROP TABLE `sentry_message` CASCADE; []
我该怎么办
I got this error while migrating Sentry app in django. I am using mysql
! 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 `sentry_groupedmessage` CASCADE; []
= DROP TABLE `sentry_message` CASCADE; []
what should i do
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的问题是迁移失败,并且 MySQL 不支持事务,因此 South 不知道表处于哪种状态。
此时恢复它的唯一方法是:
Your problem is that the migration failed, and MySQL does not have support for Transactions, so South doesn't know in which state the tables are in.
The only way how you can recover it from this point is:
除了托马斯的回答之外;如果您在重新运行迁移期间遇到密钥
content_type_id
的任何IntegrityError
,还请删除专门为应用程序模型创建的权限。该错误类似于以下内容:IntegrityError: (1062, "Duplicate entry '209-view_' for key 'content_type_id'")
在这种情况下,请从表中删除这些权限auth_permission。您可以对模型名称进行
类似
搜索,以查找所有权限(查看、添加、更改、删除)。Select * from auth_permission where codename like '%'
上面的命令将为您获取模型的所有权限,您可以获取它们的 ID 并删除(或简单地编写一个连接)。
Additional to Thomas's answer; If you are getting any
IntegrityError
for a keycontent_type_id
during the re-run of the migration, also remove the permissions that are created specifically for models of the application. The error would be similar to the following:IntegrityError: (1062, "Duplicate entry '209-view_<model name>' for key 'content_type_id'")
In that case, remove these permissions from the table auth_permission. You can do a
like
search for your models name to find all the permissions (view, add, change, remove).Select * from auth_permission where codename like '%<model name>'
The command above will get you all the permission for your model, you can get their ID and delete (or simply write a join).