Kent Sølvsten wrote:
When 1.0.1 is deployed, *some* of the entities will be migrated to 1.0.1
When 1.1 is deployed, the persistent state will contain some rev-1.0 and
some rev-1.0.1 entities.
Correction: all entities will be migrated to 1.0.1, it's just that most
entities will not change at all during that migration. The stored
version of all entities must be "1.0.1" though.
We can just express the migration rules as:
* add property X to all 1.0 instances (thus upgrading them to 1.0.1)
* add property Y to all 1.0.1 instances (thus upgrading them to 1.1)
When we fetch an 1.0 entity, both migrations should be performed before
returning the entity to the client.
So in the normal case it is sufficient to base the migration on the
existing version (and remember to update the applicationversion on the
entity).
Hm.. I'm not sure what you mean by "base the migration on the EXISTING
version". The rules have to be *expressed* with the version being
migrated TO, not from.
Let's say you have 1.0, 1.0.1, 1.0.2, 1.0.3, and 1.1. In 1.0-1.0.3 there
are no changes at all. Then 1.1 adds a property. This should be
expressed as:
migration.toVersion("1.1").onEntity("someentitytype").addProperty("X","defaultvalue");
If the migrator sees an Entity with version 1.0, 1.0.1, 1.0.2 or 1.0.3,
given the above rule it can make the change (add the property) and bump
the version to 1.1.
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev