django python - 关系不存在 [英] django python - relation does not exist
问题描述
在我的postgressql数据库中,我有一些剩余表。我现在认为,在我升级到django 1.7之前,当我更改了很多桌子的名字之前,剩余的表格是盈余的。剩余表名没有任何数据。
在我检查了我的迁移后,在搜索我的项目后,找到了剩余的表名,找不到引用,我删除/
我可以更新现有记录并添加新记录,但在删除表后,我无法删除现有记录。
现有且正确的表名称为 core_namedetails
。这是存储所有用户名称详细信息的表。
我在postgressql数据库中删除的表是 core_resume_name_details
。
当我尝试从 core_namedetails
中删除一条记录时,这是我遇到的错误:
/ resume_details / name_details / delete / 251 /
关系中的ProgrammingErrorcore_resume_name_details不存在
LINE 1:DELETE FROMcore_resume_name_detailsWHEREcore_resume_na ...
^
请求方法:GET
请求URL:http://127.0.0.1:8000/resume_details/name_details/delete/ 251 /
Django版本:1.7.2
异常类型:ProgrammingError
异常值:
关系core_resume_name_details不存在
LINE 1:DELETE FROMcore_resume_name_details WHEREcore_resume_na ...
我已经运行 makemigrations
和迁移
。没有任何问题返回。
我搜索过Google&所以没有什么我发现我的错误。
有没有人有任何解决方案这个问题?
问题是一个损坏的迁移文件。我最终跟踪了损坏的文件并修复了令人讨厌的代码行。
希望这有助于某人。
I am running django 1.7 & python 2.7.
In my postgressql db, I had some surplus tables. I now believe that the surplus tables were made surplus when I changed the names of many of my tables some time ago, before I upgraded to django 1.7. The surplus table names did not have any data in them.
After I checked my migrations and after searching my project for the surplus table names and finding no reference, I deleted/droped the tables.
I am able to update existing records and add new records, but after droping the tables, I cannot delete existing records.
The existing and correct table name is core_namedetails
. This is the table that stores all the users name details.
The table that I dropped in the postgressql db was core_resume_name_details
.
Here is the error that I am getting, when I try to delete a record from the core_namedetails
:
ProgrammingError at /resume_details/name_details/delete/251/
relation "core_resume_name_details" does not exist
LINE 1: DELETE FROM "core_resume_name_details" WHERE "core_resume_na...
^
Request Method: GET
Request URL: http://127.0.0.1:8000/resume_details/name_details/delete/251/
Django Version: 1.7.2
Exception Type: ProgrammingError
Exception Value:
relation "core_resume_name_details" does not exist
LINE 1: DELETE FROM "core_resume_name_details" WHERE "core_resume_na...
I have run makemigrations
and migrate
. No issues are returned.
I have searched google & SO, but nothing I found shed any light on my error.
Does anyone have any solutions to this issue?
The issue was a corrupt migration file. I eventually traced the corrupted file and fixed the offending line of code.
Hope that this helps someone.
这篇关于django python - 关系不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!