feat(db): add grade_record_answers migration and update schema

- Add migration 0010 for grade_record_answers table

- Update shared DB schema with new table definitions
This commit is contained in:
SpecialX
2026-06-24 12:01:26 +08:00
parent eb28a523cb
commit 9d87388524
2 changed files with 144 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
CREATE TABLE `grade_record_answers` (
`id` varchar(128) PRIMARY KEY NOT NULL,
`grade_record_id` varchar(128) NOT NULL,
`question_id` varchar(128) NOT NULL,
`score` decimal(6, 2) NOT NULL,
`full_score` decimal(6, 2) NOT NULL,
`feedback` text,
`created_at` timestamp DEFAULT (now()) NOT NULL,
`updated_at` timestamp DEFAULT (now()) NOT NULL,
CONSTRAINT `gra_gr_fk` FOREIGN KEY (`grade_record_id`) REFERENCES `grade_records`(`id`) ON DELETE cascade ON UPDATE no action,
CONSTRAINT `gra_q_fk` FOREIGN KEY (`question_id`) REFERENCES `questions`(`id`) ON DELETE cascade ON UPDATE no action
);
CREATE INDEX `grade_record_answers_record_idx` ON `grade_record_answers`(`grade_record_id`);
CREATE INDEX `grade_record_answers_question_idx` ON `grade_record_answers`(`question_id`);