Hi Oleg!

I am considering switching to your way of doing schema changes.
I would very much appreciate more information regarding the process you use to do these things.

For instance, given that I have a working MyThing class, to which I'd like to add a field my_field - would you write the upgrade script first, and then copy the field definitions to the MyThing class? Would you do it the other way around?
Once both are updated, do you have a special order of doing things when moving it to production?

Thanks ahead,

On Tue, Apr 20, 2010 at 2:45 PM, Oleg Broytman <phd@phd.pp.ru> wrote:
On Mon, Apr 19, 2010 at 04:11:09PM +0300, Imri Goldberg wrote:
> Re using sqlobject-admin: I'm curious - what is your preferred way of
> managing db migrations (i.e. versioning schema changes)?

  I seldom do a simple ADD/DELETE COLUMN. Usually when I change the schema
it's more like "collect some info, ADD COLUMN, put info into the new column".
Something like this (code from a real script upgradedb5.py):


   if db_conn.dbName == 'sqlite':
       db_conn.use_table_info = True

   if 'userID' not in ExportResult.sqlmeta.columns:
       ExportResult.sqlmeta.addColumn(ForeignKey('User', name="user",

       for result in ExportResult.select(ExportResult.q.plate <> None):
           result.user = result.plate.user



  This is a rather simple example. Sometime there is a lot of code to
collect information before schema changing and even more code that puts the
collected information into the new columns.

    Oleg Broytman            http://phd.pp.ru/            phd@phd.pp.ru
          Programmers don't die, they just GOSUB without RETURN.

Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
sqlobject-discuss mailing list

Imri Goldberg
http://plnnr.com/ - automatic trip planning
-- insert signature here ----