MDL-29877 core_grade:add some upgrade code to fix broken grade items introduced by bad restores