Review SQL INSERT/UPDATE queries during Upgrade

There are some simple solutions here which might be enough for your needs