[MODM-43] Explicit schema migration Created: 10/Aug/10 Updated: 17/Aug/10 Resolved: 17/Aug/10
|Project:||Doctrine MongoDB ODM|
|Reporter:||Vladimir Razuvaev||Assignee:||Jonathan H. Wage|
Currently supported ways of schema migration are sufficient in many cases. But I think it's worth considering to have more explicit way to migrate schema for better readability / code maintenance.
It might be useful to be able to transform original MongoDb data prior to hydration. Maybe as a new lifecycle callback (e.g. preLoad). This way one could have special property for schema version in the document and normalize data according to version differencies. e.g.:
Just as example. It also simplifies writing tests for schema migrations as I think. Is it possible with current ODM internals? What do you think?
|Comment by Jonathan H. Wage [ 10/Aug/10 ]|
I think this can be implemented already without having to change Doctrine. You just need to manage a version field and use the preLoad() like you are above. It is an acceptable idea, but I think it is already possible. What do you think?
|Comment by Vladimir Razuvaev [ 11/Aug/10 ]|
It's great if it is already possible. But I think there is no "preLoad", "preHydrate" or similar event right now. At least I didn't find one in code or docs.
|Comment by Jonathan H. Wage [ 11/Aug/10 ]|
Ok, I think maybe we can add a preLoad() event.
|Comment by Jonathan H. Wage [ 17/Aug/10 ]|