How to deal with missing properties on nodes from earlier versions
Hi guys, imagine the following scenario:
I have a custom Template, let's call it my-template. This template is used to create Pages with properties called propA, propB and propC. My Sling scripts under /apps/<...>/components expects the Pages under /content to have those properties.
This is deployed to production environment and everything works fine.
Now, the business needs changes and I need to change my-template. It now has properties propA, propX and propY, where:
- propX is the same of former propB, but the previous name doesn't make more sense;
- propY is a brand new property and,
- propC was deleted as we don't need it anymore.
Then, my questions are:
- How should my Sling scripts deal with the old Pages (the ones with propA, propB and propC) created before the new Template properties where there?
- Should I write my code to deal with both "versions" of Page I might have in the production environment?
- Having a relational database background, I would run a update SQL script to fix the old data. But how can I do such a thing with JCR? And more, Am I supposed to do such a thing?
- And lastly, how about nodes that are not under /content (e.g. /etc nodes)?
I hope I could get my idea through. Shall you have any question, please, let me know.
Thank you in advance.