Using South To Migrate a Django Database

From Bridges Lab Protocols
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Installation

  • Install South using pip (pip install south)
  • Add 'south' to INSTALLED_APPS

Initial

  1. Backup the database
  2. Run python manage.py syncdb to create south migration tables
  3. For each app enter python manage.py schemamigration appname --initial. This will create the initial migration.
  4. If there is pre-existing data in the database enter python manage.py migrate --fake to run a fake migration.

Migrate Schema Changes

  1. Make some change to the database schema
  2. Enter python manage.py schemamigration appname description-of-changes --auto
  3. Enter python manage.py migrate appname