Thanks to the answers by Dominique Guardiola and hobs, it helped me solve a hard problem.
However there are a couple of issues with the solution, here is my take on it.
Using manage.py reset south
is not a good idea if you have any third party apps that uses South, for example django-cms
(basically everything uses South).
reset south
will delete all migration history for all apps that you have installed.
Now consider that you upgrade to the latest version of django-cms
, it will contain new migrations like 0009_do_something.py
. South will surely be confused when you try to run that migration without having 0001
through 0008
in the migration history.
It is much better/safer to selectively reset only the apps that you are maintaining.
First of all, make sure that your apps don't have any desync between migrations on disk, and migrations that have been executed on the database. Otherwise there will be headache.
1. Delete migration history for my apps
sql> delete from south_migrationhistory where app_name = 'my_app';
2. Delete migrations for my apps
$ rm -rf my_app/migrations/
3. Create new initial migrations for my apps
$ ./manage.py schemamigration --initial my_app
4. Fake execute the initial migrations for my apps
This inserts the migrations into south_migrationhistory
without touching actual tables:
$ ./manage.py migrate --fake my_app
Step 3 and 4 is actually just a longer variant of manage.py convert_to_south my_app
, but I prefer that extra control, in such delicate situation as modifying the production database.