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, Imri On Tue, Apr 20, 2010 at 2:45 PM, Oleg Broytman <p...@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): > > log.open("upgradedb5.log") > > 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", > default=None), > changeSchema=True) > > for result in ExportResult.select(ExportResult.q.plate <> None): > result.user = result.plate.user > > commit() > > log.close() > > 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. > -- > Oleg Broytman http://phd.pp.ru/ p...@phd.pp.ru > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > Download Intel® 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. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > sqlobject-discuss mailing list > sqlobject-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ----
------------------------------------------------------------------------------
_______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss