South enables schema and data migration of a django-backend database [http://www.djangopro.com/2011/01/django-database-migration-tool-south-explained/]. Migrations should be version-controlled [http://stackoverflow.com/questions/10083130/what-is-the-correct-way-to-deal-with-db-migration-while-using-south-django-and].
In order to add South to Django project, development & production do the following [http://stackoverflow.com/questions/4035296/adding-south-to-django-project-development-production]: :: $ ./manage.py snycdb $ ./manage.py convert_to_south myproject.myapp $ ./manage.py schemamigration myproject.myapp --auto # Change models $ ./manage.py migrate myproject.myapp # Alternatively to get a fresh Django database with existing South migrations
sync all tables and perform fake migration [http://www.troeger.eu/cms/?p=317]: :: $ ./manage.py syncdb --all $ ./manage.py migrate --fake
If required south can be resetted [http://lincolnloop.com/blog/2011/jun/20/resetting-your-south-migrations/; https://groups.google.com/forum/?fromgroups#!topic/south-users/PxEskcnkibc[1-25]; https://groups.google.com/forum/#!msg/south-users/iIQT8ZWs2cI/GQ4kONoT5Q4J[1-25.
schemamigration --auto commadn created migration files from the
models.py, but it is possible to tweak them if necessary. If they were tweaked then the changes need to be saved somewhere.
migrate command compares migration files with DB Content. Thus if mgration files are moved with the source code to the serer, where there are previous souht DB Content it will apply precisley all the migrations needed to bring the DB in sync with the source code.
To go back in forward in the south migration history simply define the migration to move: ::
$ ./manage.py migrate <appname> 0005
South allows to rename a django app, through some manual steps are required [http://stackoverflow.com/questions/4566978/renaming-an-app-with-django-and-south].
A step-by-step example of renaming django app, managed by South migration history is described here: https://github.com/ASKBOT/django-south-app-rename-example
Moving models between apps is straightforward
$ ./manage.py schemamigration specific create_cat --auto $ ./manage.py schemamigraiion common drop_cat --auto
To list all migrations without actually running them execute this: ::
./manage.py migrate --list