Django-关系“ relation”不存在。无法运行python manage.py migration? [英] Django - Relation "relation" does not exist. Cannot run python manage.py migrate?

查看:134
本文介绍了Django-关系“ relation”不存在。无法运行python manage.py migration?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我很傻,我去删除了django应用程序中的一个表,因此打开了psql并运行了 Drop table;丢下桌子然后我删除了模型并运行 python manage.py migration,然后收到此错误...

  django.db。 utils.ProgrammingError:在上面的其他内容中,不存在关系 textchange_myuser 



所以现在我无法正确删除表,也无法将其取回。我该怎么办?



谢谢。

解决方案

按我的说法评论,根据您的情况,您可以运行:

  python manage.py migration yourapp --fake 

伪造应用迁移,但实际上并未更改您的数据库。



您可以阅读更多的这里



希望这会有所帮助。


So I was being stupid and I went to delete one of the tables in my django app so opened up psql and ran "Drop table ;" and dropped the table. Then I deleted my model and ran "python manage.py migrate" and I get this error...

django.db.utils.ProgrammingError: relation "textchange_myuser" does not exist

among other stuff above it.

So now I can't delete the table properly and I can't get it back. What do I do?

Thanks.

解决方案

As per my comment, in your situation you might run:

python manage.py migrate yourapp --fake

to "fake" applying the migration but not actually alter your database.

You can read more HERE

Hope this helps.

这篇关于Django-关系“ relation”不存在。无法运行python manage.py migration?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆