Django Plugins — Django South for Database Migrations

Database migrations handled easily. Now I can add the migration files that are generated to the GIT repository PER-BRANCH and grab them on the production server when the time comes.

UPDATE 9 months later when I realized this is one of the top results for django south.

I might as well write a simple tutorial on how to use it. Read the South docs, but in as few lines of code as possible, here’s what to do:

pip install South
### modify settings.py and add 'south' to INSTALLED_APPS
python manage.py syncdb
# adds south tables
python manage.py schemamigration myapp --initial
# sets up your app for the first migration.
python manage.py migrate myapp --fake
# "fakes" a migration because you will get an error if you try to migrate
# from an existing database setup. You will get a "table already exists" error otherwise.
### modify your app models, then auto-create a migration
python manage.py schemamigration myapp --auto
# this will auto detect the changes
python manage.py migrate myapp
# will apply new migration.
git add myapp/migrations/
# add migrations to version control
### download migrations on remote machine, and simply type in
python manage.py migrate
# note: this is after faking the first migration if the database exists.