On Tuesday 28 February 2006 03:26, Jacob Kaplan-Moss wrote: > Hey folks -- > > I've posted (over 1200 words of) my thoughts on schema evolution to > the wiki: http://code.djangoproject.com/wiki/SchemaEvolution. > > Any thoughts before I start on this?
As others have said - great work. I'm not sure about versioning on a per model basis -- I think a single version number per database (or, more likely, per 'app') is better. Upgrades will often affect more than one model, esp foreign key type changes. For databases that support transactions, you will want to do changes to the all the affected models or nothing at all, so having a single version number to update when you have successfully upgraded seems to make much more sense. At my day job I know we have a system for clients web sites that works in this way. It also has the concept of multiple 'apps' within a physical database, and has a single 'schema' table that is used to keep track of it. This method also has the advantage that version numbers don't pollute your model, but store this in a separate table. It might also be nice to keep track of all past updates, not just the current version -- so as well as an integer field for the version number you'd have a text field containing the actual SQL that was executed to upgrade to that version, and the date of upgrade for completeness. That could be a great help for debugging problems, and reproducing the schema of the live DB on a testing database. There might be a problem if someone changed the DB schema outside of the django method, but even then, there would at least be a table where they could manually log what they've done. It might even be possible to inspect those tables and check that the current schema is what it ought to be. Luke -- "Procrastination: Hard work often pays off after time, but laziness always pays off now." (despair.com) Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---