MDL-57649 mod_lesson: Additional refinement to upgrade script.