Skip to content
Ford edited this page Aug 14, 2013 · 3 revisions

Documentation: http://south.readthedocs.org/en/latest/
Description: South is a django application for model data and schema migrations.
Usage:

  • Create the initial schema migration file (necessary if the model is new)

      python manage.py schemamigration appname --initial [migration name]
    
  • Apply schema migrations

      python manage.py migrate [appname]
    
  • Create a schema migration after a model has changed

      python manage.py schemamigration appname --auto [migration name]
    
  • Update the previous schema migration

      python manage.py schemamigration --auto --update [migration name]
    
  • Graph migrations (GraphViz must be installed)

      python manage.py graphmigrations | dot -Tpng -omigrations.png
    
    • If you're having issues installing GraphViz libraries, you can pipe graphmigrations output into a dot file and open it in GraphViz manually:

        python manage.py graphmigrations > graph.dot
      
  • Create a data migration (See the data migration tutorial)

      python manage.py datamigration appname datamigrationname
    
    • You will almost always have to create a data migration if you are replacing/removing fields from an existing model and need to move the data to another field or model.

Clone this wiki locally