I just took a look at this new feature for the first time. It is nice
to be able to set a SchemaUpdateStrategy in the model. From my
perspective, it is a little strange that this functionality is not
based on the DbMerger.
There is one hint to the reason for this in CAY-1193: "This version
non use DBMerger for ThrowOnPartialSchemaStrategy and
ThrowOnPartialOrCreateSchemaStrategy. In this strategy used new
StrategyAnalyser, which can speed up implementation in oracle."
If StrategyAnalyser is faster than DbMerger on oracle, is it possible
to make DbMerger faster as well? I do not have access to Oracle, and
know metadata fetching in Oracle is super slow.
Is it ok if I create a new SchemaUpdateStrategy that use the DbMerger?
It will be a "safe" version that only adds tables and columns, not
remove them. And expand, but not shrink column length.
Some people are already using DbMerger for auto-upgrade during
startup. I do this in 3 steps. The first step could fit in a
1. Use DbMerger and issue all the safe tokens. That is all tokens that
does not remove information.
2. Use cayenne code to fill/update content of database. This is
3. Offer the user to "clean up" the database using all the unsafe
tokens that typically remove columns and so on.