Fix student grade registration: set grade_10 as default, add auto-heal for legacy tawjihi_2008, add student grade selector and update-grade API

This commit is contained in:
Hamza-Ayed
2026-09-09 01:06:35 +03:00
parent 8183e53b86
commit 0a2ca71cb4
13 changed files with 440 additions and 41 deletions
@@ -0,0 +1,10 @@
-- ==============================================================================
-- Migration: Fix student grade defaults to Grade 10 instead of Tawjihi 2008
-- ==============================================================================
ALTER TABLE `students` ALTER COLUMN `grade_level` SET DEFAULT 'grade_10';
ALTER TABLE `school_rosters` ALTER COLUMN `grade_level` SET DEFAULT 'grade_10';
-- Repair existing students who were accidentally defaulted to tawjihi_2008 / grade_12
UPDATE `students` SET `grade_level` = 'grade_10' WHERE `grade_level` IN ('tawjihi_2008', 'grade_12');
UPDATE `school_rosters` SET `grade_level` = 'grade_10' WHERE `grade_level` IN ('tawjihi_2008', 'grade_12');