开发者

Google App Engine, BigTable and model evolution

I am currently playing with Spring/JPA/Google App Engine, and there is an issue that I am worrying about.

The cool thing wit开发者_开发百科h GAE is, once my mapping is defined, I just need to insert data and everything associated to it is stored too.

However, if I happen to change my mapping, how can I do with my previous data ? Do I have to create migration scripts each time something has changed ? Is there a way to use Liquibase or something like that in this case ? Or is there another way to handle these changes on existing data ?

Thanks a lot for your help! Rolf


It depends on the nature of those changes, but in most cases, at least some light updating will be required. One big thing to keep in mind is parent-child relationships (see this previous question for more details) and entity groups while design; since parents become part of an entity key, they are very much immutable. Same with key names.

Another thing is that app engine entities are schemaless; for example if you have some class Foo and you suddenly add a property, prop = db.BooleanProperty(default=True) to it, all existing Foo entities will not have prop set to True (though new ones will). Likewise, you will have to manage ReferencePropertys and ListProperty(db.Key) manually. App Engine does have a _set operator to help with this, but to be honest I've found it to be a bit unreliable, with _sets coming out empty when I knew for a fact that they should not be. Regardless, here's the documentation on using the _set functionality.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜