Re: [SQLObject] Upgrading Existing Instances to New Derived Classes
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Kevin D. <da...@gm...> - 2005-08-03 02:05:18
|
Schema migration is always an interesting topic. I believe the new version of ActiveRecord (Ruby on Rails) includes a feature for doing schema migration, and I'd be curious to see their approach. What puzzles me about the scenario that you've set up is that any code that references MyExistingBaseClass will have to change to reference MyNewDerived class, which seems painful. My solution is this: 1) Keep track of what schema version is in use (somewhere in the database) 2) Change the existing class to match the new definition 3) when the program fires up, make sure that the database schema is in sync with the code 4) Write an upgrade script that performs appropriate alter tables and selects if the database schema is an older version than the code 5) there is no 5th step Kevin On 8/2/05, Asterio Gonzalez <ni...@ya...> wrote: > First at all, I am new in SQLObject > --------------------------------------------------PROBLEM: > -------------------------------------------------- > (1) I have two classes: >=20 > (a) MyExistingBaseClass > (b) MyNewDerivedClass >=20 > (2) I have some existing instances of (a) in DataBase >=20 > (3) I derived (b) from (a) in code >=20 > (4) I want to reuse some existing instances from (a) > upgrading to (b) class >=20 > (5) I have not seen in code any function to make that, > so I wrote : |