Hi,
I recently changed the active objects data model of my plugin, which wasnt a big deal in the previous upgrades. This time however, I changed the annotation of a field of an active objects entity to "Unique", what is fine as long as there are no existing database entries with a null value in this field. In this case, the active objects update fails.
So the problem is, how can I make sure that the active objects update will not fail when someone is updating my plugin without knowing if there might be an entry in his database with a null value in the field that is now annotated as "Unique"? Is there a way to get rid of the the possible null values or fill them with dummy data in the customers database lazily before active objects tries to update the model?
I already read https://developer.atlassian.com/display/AO/Upgrading+your+plugin+and+handling+data+model+updates , but I couldnt figure out if thats what would help me to prepare and correct database values before the active objects update process.
Thank you!
Community moderators have prevented the ability to post new answers.
The link you mentnion is right. You have to create a new class which implements com.atlassian.activeobjects.external.ActiveObjectsUpgradeTask and in the upgrade method you should do a find for all rows wich may cause problems (in your case the ones containing null values) and modify them as needed.
That task should run during the upgrade/installation of the plugin so your data is ready for the new model. It works in a similar way to the classes implementing PluginUpgradeTask, but for ActiveObjects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.