Search code examples
pythondjangodjango-south

South - How to force certain migration?


I have a migration, 003, that creates a new table, but for some reason, South isn't creating a new table after executing that migration: I am doing the following command:

[kelp@web187 goals]$ python2.7 manage.py migrate main 0003_auto__add_nudge
Running migrations for main:
 - Migrating backwards to just after 0003_auto__add_nudge.
 < main:0006_auto__add_field_nudge_status

But I get the following error:

django.db.utils.DatabaseError: relation "main_nudge" does not exist

It doesn't exist because the migration 003 is supposed to create it. Why do I get this error?


Solution

  • It seems like you've faked migration 0006 forward, you should fake it backward too:

    manage.py migrate --fake yourapp 0005
    

    This will set the current migration to 0005.

    Apparently, you want to migrate back to 0002:

    manage.py migrate --fake yourapp 0002
    

    And then start over at 0003:

    manage.py migrate yourapp