Search code examples
databasedjangodjango-modelsdjango-southpsql

Reverse migration with South throwing error because table doesn't exist


I am trying to do a rollback with South in my django app. I am getting this message when I run my command: DatabaseError: table "forms_logo_version" does not exist. This is the command I'm running python manage.py migrate myformsapp 0044.

I've checked the DB and the table does not exist, but why is this a problem? If I am deleting the table anyway, why is this throwing an error? Is there anyway I force the script to continue?

I have simply created a blank table in the database and the script ran fine after that. I would still like to know the answer to my questions above.


Solution

  • You can find in your migrations file 0044_*.py method named backwards and remove line with something similar to db.delete_table('forms_logo_version'). If you do this makes some tests. Connect to empty db and make forward migration and backwards, to be sure your changes don't affect another migration file.

    I recommend you to figure it out why this table is missing from db? Probably South create this table (look into migrations) and only South should remove it.