Posted by gavin on April 16, 2013, 6 p.m.
Fusionbox is supporting the development of django migrations
When Andrew Godwin announced his kickstarter proposing to improve
the state of Django's migration system this morning, I knew it would be
perfect for Fusionbox to sponsor. Andrew Godwin is author of South,
the de-facto migration solution for Django, and a Django committer, so
he's the perfect person to take this on. Fusionbox makes heavy use of
South, so we're excited about the improvements Andrew is working on.
Django doesn't come with a system for migrations in its core, so South
has become widely used. It works very well, and has served us well, but
a revamp will be highly useful.
Some of the things we're excited about:
- Declarative migrations. In South, a schema migration is imperative
it runs by executing python code to change the schema. New migrations
will be declarative -- a migration is a data structure representing the
changes that need to happen to the schema. This allows higher-level
analysis of the changes, like reconstructing the state of the ORM at a
specific point in time, or estimating how long a migration will take.
This method of ORM snapshotting will replace the big ugly dict at the
bottom of all your migrations.
- Automatic collapsing of migrations. As a project goes on, it can
accumulate hundreds of migrations that make reading the history of
the schema hard. Django migrations will support combining multiple
migrations into a single one, just like git-rebase.
- Native schema manipulation in Django. Django has been reluctant
to make schema changes to built-in apps for backwards compatibility
reasons. Having schema alteration in core will allow them to change
schema without breaking compatibility.
- Automatic dependency detection. Since South migrations belong to a
single app, when there are inter-app dependencies (like a foreign to to
another app), the dependencies must be explicitly specified. It should
now be possible to detect this in some cases, and compute the dependency
The kickstarter project is already fully funded, even exceeding some
of the loftier goals. It sounds like Andrew has even more ideas on
improving migrations, so we'll be listening.