cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Zeigler <robert.zeig...@roxanemy.com>
Subject Re: Update schema
Date Tue, 03 May 2011 00:28:27 GMT
In the modeler, there are tools for migrating a database schema, so the basic functionality
exists, but...
Migrating a db schema is inherently tricky.  If you're adding a new column... what should
be the value supplied for existing records, for instance?
The complexity only increases from there.
What I've done in the past is to use the the db migration tools in the modeler to generate
a set of sql updates, augmented those updates (sometimes with sql, and sometimes with code),
and then created a "db patcher" tool.  One strategy that worked reasonably well was to have
a small, unmapped table in the database that keeps track of the current "patch level" of the
db.  The tool would then find all of the unapplied patches and apply them in incremental order.
 This strategy allowed for some fairly complex schema changes (splitting data from a table
into a separate joined table, for instance) which still largely automating the process of
schema migration across multiple application installations.

Robert

On May 2, 2011, at 5/27:15 PM , Steve Springett wrote:

> Currently I'm using CreateIfNoSchemaStrategy and it seems to work quite well
> for the database platforms I'm targeting.
> 
> My question is, is there any way or examples somewhere to update the schema
> if it's different?  For example, if the map contains an additional field,
> table or index I would like Cayenne to be able to create the field, table or
> index to match what is in the map. This would occur on startup for example
> during a product update.
> 
> 
> --Steve


Mime
View raw message