Is there a way a not null constraint be forcibly applied on plugin reload as explained in the description of this Topic?

This is the issue I am facing while working on one of our confluence plugin bugs. In the earlier stages of development of this plugin, the previous developers forgot to add a “@NotNull” constraint on one column, say ‘ColA’, in the Active Object Entity code. Now we figured out we need to add that constraint back again. But what will happen is that the plugin will fail to install in a confluence instance that already has the null value set for ColA. For such scenarios we need something on the lines of the steps below:

  1. If this is not the first installation of the plugin AND if the AO doesnt have a not null constraint for that column yet, then check if that column ColA has a null value set.
  2. If there is a null value set for ColA, then prepopulate it with a random value and THEN apply “@NotNull” constraint on that ColA.

Are the above two steps possible to be done in any way from the Active Objects Java code itself? Any pointers here would be very helpful.

PLEASE NOTE : I also tried using ActiveObjectsUpgradeTask like so : Bitbucket, in my case I just added a @NotNull constraint in the ‘upgraded’ object. But that didnt help me because it even updated the column entry even if it was already set in the previous plugin installation. We only want to upgrade the column in previous plugin installations if that column entry is set to null.