Hey,
I have just committed a first draft of the migration API and service. I
made it a part of the JDBM entitystore, but it should be moved out to
its own extension ASAP, as it really has nothing to do with JDBM (I just
put it there for convenience).
If you are interested, please take a look at the API used to declare the
rules, and see if they seem to make sense. Look at MigrationTest for
example of how to use it.
I have designed the API to allow for both upgrades and downgrades. In
some cases you may want to export data from a new installation and
import into an older one, for example. The API allows such changes to be
handled. There's also a custom migrator where you can perform any change
you want. As you get access to the JSON-object for the Entity you can
pretty much do whatever you want with it.
Here's the sample code from MigrationTest:
MigrationRules migration = new MigrationRules();
migration.fromVersion("1.0").
toVersion("1.1").
renameEntity(TestEntity1_0.class.getName(),
TestEntity1_1.class.getName()).
forEntities(TestEntity1_1.class.getName()).
renameProperty( "foo", "newFoo").
toVersion( "2.0" ).
renameEntity(TestEntity1_1.class.getName(),
TestEntity2_0.class.getName()).
forEntities( TestEntity2_0.class.getName() ).
addProperty("bar", "Some value").
removeProperty( "newFoo", "Some value" );
module.addServices( MigrationService.class ).setMetaInfo( migration );
---
Comments/suggestions?
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev