36352-vm/db/migrations/008_create_student_answers_table.sql
Flatlogic Bot 93f530e4f6 t7
2025-12-07 19:58:10 +00:00

10 lines
431 B
SQL

CREATE TABLE IF NOT EXISTS student_answers (
id INT AUTO_INCREMENT PRIMARY KEY,
student_exam_id INT NOT NULL,
question_id INT NOT NULL,
answer_text TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (student_exam_id) REFERENCES student_exams(id) ON DELETE CASCADE,
FOREIGN KEY (question_id) REFERENCES exam_questions(id) ON DELETE CASCADE,
UNIQUE KEY (student_exam_id, question_id)
);