Hacker News new | ask | show | jobs
by shebson 4536 days ago
It's great to see schema migrations move into Django core. South is great, but Django will be much better with schema migrations baked in, especially for newcomers.

For anyone coming to Django from Rails, South seems anomalous. Outside of database migrations, Django is a very battery-included framework, so it's weird that until 1.7 data migrations were handled by third party tools (mostly South) and not mentioned at all in the Django documentation.

This is a big step for Django. I'm excited for the (not too distant) future when 1.7 is the official release.

2 comments

Totally agree. It is such an important part of a Django project where Models are involved. Every release of Django brings exciting and well thought through features. Future looks great for this awesome Python framework!
I wonder if there will be a tool to convert (migrate?) South migration data to Django's native format.
The recommended upgrade path seems to be:

* Apply all South migrations to all database servers,

* Delete South migrations,

* Create new initial (create table) migrations for the current schema.

This makes sense, as migration code is supposed to be temporary. Migrations should exist in the codebase until the last database has them applied. Once all databases are up-to-date, it's better to delete them and "rebase" migrations to the current schema.

Old, fully applied migrations will still stay documented in the version control history, but they shouldn't be part of the master tree, much like obsolete code should be deleted instead of left commented out.

This has the added advantage of removing old, crufty migrations. We do this every few months, as there will usually be some problem that will prevent migrations from applying cleanly on new installations (someone made a mistake and reverted imperfectly, something collided and the resolution didn't delete some data, etc).
It has been stated by Andrew Godwin (author of South and the new native migrations) that there will be a clear path to switch from South to native migrations. And also for people who can't upgrade to 1.7 there should be South 2 with some of the new features backported from native migrations.
South2: https://github.com/andrewgodwin/south2 "This is the repository for South 2, the backport of Django's migrations code into a separate installable package for Django 1.4, 1.5 and 1.6."