Breyten Ernsting

Webdeveloper at Open State Foundation.

South Data Migrations Versus Schema Migrations

South makes a distinction between schema migrations and data migrations. But why is that a good thing?

South defines a schema migrations as “migrations which change the layout of your columns and indexes”. This is complemented by the notion of data migrations which are “used to change the data stored in your database to match a new schema, or feature”.

But, as Branko Vukelic notes, you can also dynamically generate data in a schema migration — although his solution is outdated because of South’s dry run feature. Making it work is trivial, however:

if not db.dry_run:
    foos = orm['foos.Foo'].objects.all()
    for foo in foos:
        foo.slug = slugify(

There is of course, a drawback when doing it this way: you can never regenerate the data without running the schema migration. Data migrations are also marked for no-dry-run by default, so your code ends up a bit simpler.