Skip to content

Instantly share code, notes, and snippets.

@lfalanga
Created February 21, 2013 20:04
Show Gist options
  • Save lfalanga/5007717 to your computer and use it in GitHub Desktop.
Save lfalanga/5007717 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment