Skip to content

Commit 39d527d

Browse files
fix(exams): add missing columns for AI grading
exam_questions was missing points, correct_answer, and grading_rubric columns that gradeExamWithAI queries. Without them the select fails and grading silently returns "Exam not found". Also adds evaluated_at to exam_submissions for the save_exam_feedback RPC. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 20d66bb commit 39d527d

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- =============================================================================
2+
-- Add missing columns to exam_questions for AI grading
3+
--
4+
-- The gradeExamWithAI server action selects points, correct_answer, and
5+
-- grading_rubric but these columns don't exist yet. Without them the query
6+
-- fails and AI grading silently returns "Exam not found".
7+
-- =============================================================================
8+
9+
-- Points per question (default 10)
10+
ALTER TABLE public.exam_questions
11+
ADD COLUMN IF NOT EXISTS points INTEGER DEFAULT 10;
12+
13+
-- Correct answer text for true/false and free-text reference answers
14+
ALTER TABLE public.exam_questions
15+
ADD COLUMN IF NOT EXISTS correct_answer TEXT;
16+
17+
-- Rubric for manual/AI grading of free-text questions
18+
ALTER TABLE public.exam_questions
19+
ADD COLUMN IF NOT EXISTS grading_rubric TEXT;
20+
21+
-- Also add evaluated_at to exam_submissions if missing (used by save_exam_feedback RPC)
22+
ALTER TABLE public.exam_submissions
23+
ADD COLUMN IF NOT EXISTS evaluated_at TIMESTAMPTZ;

0 commit comments

Comments
 (0)