SQL script for cleaning up Option sortOrders in database

Hi all,

There have been some issues related to the sortOrder column which makes user unable to save Option or the api return null sortOrders causing some web apps not working properly.

We have now fixed the import service so that it will detect and remove sortOrder gaps. The existing sort orders are updated with new indexes. For example [2,5] would be updated to [1,2].

For existing corrupted sortOrder records in database we have added an SQL script to clean that up, you can find it here. We are in the process of updating all of our demo databases with this script ( all versions ).

The script will only update records in table optionvalue with corrupted sortOrder. It will not update anything if no sortOrder gap found.

You can try to fix the sortOrder issue by executing this script on your database while waiting for api fix which will be included in next patch releases.

Hope this is useful, and please let us know if there is any issues.