Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 222
egidra Avatar asked Sep 11 '12 06:09

egidra


1 Answers

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
like image 180
jpic Avatar answered Nov 15 '22 05:11

jpic