Search code examples
pythondjangopostgresqlpython-2.7django-1.7

django python - relation does not exist


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?


Solution

  • 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.