lfalanga
2/21/2013 - 8:04 PM

Django-South useful commands.

Django-South useful commands.

Normal Migration
1. The developer (you) change the models.py file, updating the application's data model.
2. Run manage.py schemamigration app_name --auto to create a migration file for generation N+1.
3. Run manage.py migrate app_name to update the database schema and migrationhistory table to generation N+1.

Initial Migration
1. The developer (you) creates the first models.py file, defining the  application's data model.
2. Run manage.py schemamigrate app_name --initial to create a migration  file for generation 1.
3. Run manage.py migrate app_name to create the database schema and  migrationhistory table to generation 1.

Converting an Application

On the first app instance
1. Run manage.py convert_to_south app_name to create the migration file for generation 1, and also to create the migrationhistory entry.

On other app instance
1. Run manage.py migrate app_name 0001 --fake to create the migrationhistory without changing the database schema.

Other useful commands
1. manage.py migrate --list