> Do you have a few minutes to help turning this commit into patches  
> against 1.1 and 1.2:
> 
> http://svn.apache.org/viewvc?view=rev&revision=541595

Hmm, I will have to check out the old code then. I am only having version
3 configured for compilation. I plan to look into this on this friday.


> At the same time I've been looking to implement a similar algorithm  
> (outside Cayenne but based on Cayenne schema) for one of my projects,  
> and it is possible if you make some assumptions about the nature of  
> the schema changes (e.g. only support add/drop column, create/drop  
> table ops) and do not support porting the data (e.g. no "rename  
> column").

I guess I will have to delay our update mechanism for later but I am
currently thinking about something like this:

- Export table into XML via Cayenne
- Drop all constraints and foreign key relations
- Drop Table
- Recreate Table with new metadata
- Import table from XML via Cayenne
- Recreate all constraints, indexes and foreign key relations

I chose this strategy because of these thoughts:

- Simple changes to the data model can be managed by above strategy
without any further work needed. 
- More complex changes could be scripted (during the import we call a
class or some beanshell script or something) or the data can be changed
with some XSLT script before the import.
- I did not look to much into the constraints and foreign key relations
but creating a table is supported by the Cayenne DBAdapter which is a plus
when trying to support as many DBs as possible. So there would be no need
to do some difficult update/alter table algorithm.

What do you think?

Adrian

Reply via email to