I quite like Rails' database migration management system. It is not 100% perfect, but it does the trick. Django does not ship with such a database migration system (yet?) but there are a number of open source projects to do just that, such as django-evolution and south for example.
So I am wondering, what database migration management solution for django do you prefer? (one option per answer please)
I've been using South, but Migratory looks promising as well.
Migratory looks nice and simple.
We use Django at work, and we've been using dmigrations. While it has its quirks, it's been useful so far. Some features:
- It uses a table in the database to keep track of which migrations have been applied.
- Because it knows which ones have been applied, you can migrate up and back down.
- It integrates with
manage.py
as a command.
- The individual migration scripts are Python, but if your migration logic is pure SQL, dmigrations makes it easy to just can the SQL and have it executed.
One problem is that it only currently supports MySQL. However, one of our guys make a local hack to it to support PostgreSQL, which we use. As I recall, the hack wasn't all that extensive, so it shouldn't be terribly difficult to hack it up to support other RDBMSs.
If you are using SQLAlchemy as your ORM then the de facto standard is Alembic.
Another alternative that haven't been mentioned is yoyo-migrations.
Besides South, dmigrations, django-evolution, and Migratory I thought I would add simplemigrations as another tool I've seen for automating Django migrations.
I've used three of these in the past but do migrations by hand now. I'm thinking about trying South again due to the latest features added.
Just to note that since 2009, pretty much every project mentioned here other than South is dead. South is the de facto standard, for better or worse.
I've been using simple-db-migrate
Pros:
- it allows me to rollback the migrations (IDK if other do this too).
- integrates with manage.py
- everyone that knows SQL can create a migration
- it doesn't run a migration twice: the application writes the migration information(timestamp, query, etc.) on a table
Cons:
- if you add a migration with a lower timestamp than the latest migration installed, this migration doesn't run
- Only MySQL is supported