I'm using objectify on my GAE java server and I want to update a class entity with a field which was a list with the @Serialize annotation and I want now to transform it to a simple list.
How can I do that?
Basically you create a second field that holds your preferred format and use an @OnLoad
method to migrate the data. Then load/save all entities.
However, there's a catch. If you have a busy system, you can be assured that the old version and the new version will coexist for some number of requests. So you have to be somewhat careful about the transition. The safest way is to:
@OnLoad
, dropping the old data with @IgnoreSave(IfNull.class)
(or however you prefer)