<p>I'm currently looking at the Python framework Django for future db-based web apps as well as for a port of some apps currently written in PHP. One of the nastier issues during my last years was keeping track of database schema changes and deploying these changes to productive systems. I haven't dared asking for being able to undo them too, but of course for testing and debugging that would be a great feature. From other questions here (such as <a href="https://stackoverflow.com/questions/1607/mechanisms-for-tracking-db-schema-changes">this one</a> or <a href="https://stackoverflow.com/questions/173/how-do-i-version-my-ms-sql-database-in-svn">this one</a>), I can see that I'm not alone and that this is not a trivial problem. Also, I found many inspirations in the answers there.</p>

<p>Now, as Django seems to be very powerful, does it have any tools to help with the above? Maybe it's even in their docs and I missed it?</p>

[{'answer_id': 20052, 'author': 'fulmicoton', 'author_id': 446497, 'author_profile': 'https://Stackoverflow.com/users/446497', 'pm_score': 2, 'selected': False, 'text': '<p>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:</p>\n\n<ul>\n<li>Rename or add a column on a populated DB. You need to do that by hand.</li>\n<li>Refactorize your model (like split a table into two) and repopulate your DB accordingly.</li>\n</ul>\n\n<p>It might be possible though to write a Django script to make the migration by playing with the two different <a href="https://docs.djangoproject.com/en/dev/topics/db/models/" rel="nofollow noreferrer">managers</a>, but that might take ages if your DB is large.</p>\n'}, {'answer_id': 20215, 'author': 'varikin', 'author_id': 1794, 'author_profile': 'https://Stackoverflow.com/users/1794', 'pm_score': 5, 'selected': True, 'text': '<p>There are at least two third party utilities to handle DB schema migrations, <a href="http://aeracode.org/projects/south/" rel="noreferrer">South</a> and <a href="http://code.google.com/p/django-evolution/" rel="noreferrer">Django Evolution</a>. I haven\'t tried either one, but I have heard some good things about South, though Evolution has been around a little longer.  </p>\n\n<p>Also, look at <a href="http://code.djangoproject.com/wiki/SchemaEvolution" rel="noreferrer">SchemaEvolution</a> on the Django wiki.  It is just a wiki page about migrating the db.</p>\n'}, {'answer_id': 43341, 'author': 'jamting', 'author_id': 2639, 'author_profile': 'https://Stackoverflow.com/users/2639', 'pm_score': 0, 'selected': False, 'text': '<p>And now there\'s also <a href="http://code.google.com/p/dmigrations/" rel="nofollow noreferrer">dmigrations</a>. From <a href="http://simonwillison.net/2008/Sep/3/dmigrations/" rel="nofollow noreferrer">announcement</a>:</p>\n<blockquote>\n<p>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. <strong>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.</strong></p>\n<p>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.</p>\n</blockquote>\n<p>(My bold)</p>\n'}, {'answer_id': 48274, 'author': 'Łukasz', 'author_id': 4999, 'author_profile': 'https://Stackoverflow.com/users/4999', 'pm_score': 0, 'selected': False, 'text': '<p>I heard lot of good about <a href="http://code.google.com/p/deseb/" rel="nofollow noreferrer">Django Schema Evolution Branch</a> and those were opions of actual users. It mostely works out of the box and do what it should do.</p>\n'}, {'answer_id': 94321, 'author': 'Slavus', 'author_id': 17873, 'author_profile': 'https://Stackoverflow.com/users/17873', 'pm_score': 0, 'selected': False, 'text': '<p>U should lookup <a href="http://code.google.com/p/dmigrations/" rel="nofollow noreferrer">Dmigrations</a>, it functions a little bit diffrent from  django-eveoltions.\nIt shows you everything it is doing and for compliccated things it asks you for your intervetnions. It should be great.</p>\n'}, {'answer_id': 131680, 'author': 'TimB', 'author_id': 4193, 'author_profile': 'https://Stackoverflow.com/users/4193', 'pm_score': 1, 'selected': False, 'text': '<p>There was a panel session on DB schema changes at the recent DjangoCon; there is a <a href="http://au.youtube.com/watch?v=VSq8m00p1FM" rel="nofollow noreferrer">video of the session</a> (thanks to Google), which should provide some useful information on a number of these utilities.</p>\n'}]
['https://Stackoverflow.com/questions/20021', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2077/']