问题描述
所以我很傻,我去删除了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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!