- Add migration 0010 for grade_record_answers table - Update shared DB schema with new table definitions
15 lines
781 B
SQL
15 lines
781 B
SQL
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`);
|