how to restore dropped table with django-south?
It's a pretty late response but for people who will run into the same issue (like I did).
Normally to drop the db_tables for the app that is managed by south you should use:
python manage.py migrate appname zero
But if you dropped them manually in the db let south know about it
python manage.py migrate appname zero --fake
And of course to recreate the tables
python manage.py migrate appname
Had the identical problem. Not sure this works in all circumstances, but here's what I did:
- comment out "south" from INSTALLED_APPS
- run manage.py syncdb
- uncomment "south" in INSTALLED_APPS
- run manage.py migrate
Voila!
Your mileage may vary....
Hmm this exchange covers my very question:
If you modify the database by hand, South won't notice - its only way of keeping track of what version the database is is the south_migrationhistory table, so if you fiddle behind its back, it's your responsibility to fix it.
What I ended up doing was commenting out the model that I dropped in question, doing a schemamigration
, creating an empty no-column table of the one I dropped (so South has something to drop), migrate
ing, then un-commenting the model, schemamigration
and migrate
ing again. A bit more annoying than just dropping the table and syncdb
but ah well.