[Solved]-Version track, automate DB schema changes with django

12👍

There are at least two third party utilities to handle DB schema migrations, South and Django Evolution. I haven’t tried either one, but I have heard some good things about South, though Evolution has been around a little longer.

Also, look at SchemaEvolution on the Django wiki. It is just a wiki page about migrating the db.

2👍

Last time I checked (version 0.97), syncdb will be able to add tables to sync your DB schema with your models.py file, but it cannot:

  • Rename or add a column on a populated DB. You need to do that by hand.
  • Refactorize your model (like split a table into two) and repopulate your DB accordingly.

It might be possible though to write a Django script to make the migration by playing with the two different managers, but that might take ages if your DB is large.

1👍

There was a panel session on DB schema changes at the recent DjangoCon; there is a video of the session (thanks to Google), which should provide some useful information on a number of these utilities.

👤TimB

0👍

And now there’s also dmigrations. From announcement:

django-evolution attempts to address this problem the clever way, by detecting changes to models that are not yet reflected in the database schema and figuring out what needs to be done to bring the two back in sync. In contrast, dmigrations takes the stupid approach: it requires you to explicitly state the changes in a sequence of migrations, which will be applied in turn to bring a database up to the most recent state that reflects the underlying models.

This means extra work for developers who create migrations, but it also makes the whole process completely transparent—for our projects, we decided to go with the simplest system that could possibly work.

(My bold)

0👍

I heard lot of good about Django Schema Evolution Branch and those were opions of actual users. It mostely works out of the box and do what it should do.

0👍

U should lookup Dmigrations, it functions a little bit diffrent from django-eveoltions.
It shows you everything it is doing and for compliccated things it asks you for your intervetnions. It should be great.

👤Slavus

Leave a comment