Harden published curriculum and student flows
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
-- Apply after database_schema.sql. Rollback: disable the new endpoints, preserve
|
||||
-- attempt rows for audit, then remove the column/table only after export.
|
||||
ALTER TABLE student_error_notebook
|
||||
ADD COLUMN retention_due_at TIMESTAMP NULL DEFAULT NULL AFTER mastered_at;
|
||||
|
||||
-- Existing question rows remain draft. A reviewer must approve each question
|
||||
-- against the named lesson and record its source before it may prove remediation.
|
||||
ALTER TABLE questions
|
||||
ADD COLUMN remediation_review_status ENUM('draft','approved','rejected') NOT NULL DEFAULT 'draft',
|
||||
ADD COLUMN remediation_reviewed_by BIGINT UNSIGNED NULL,
|
||||
ADD COLUMN remediation_reviewed_at TIMESTAMP NULL DEFAULT NULL,
|
||||
ADD COLUMN remediation_source_reference VARCHAR(700) NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS error_notebook_quiz_attempts (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
uuid CHAR(36) NOT NULL,
|
||||
error_id BIGINT UNSIGNED NOT NULL,
|
||||
student_id BIGINT UNSIGNED NOT NULL,
|
||||
phase ENUM('initial','retention') NOT NULL,
|
||||
question_ids_json JSON NOT NULL,
|
||||
answer_key_json JSON NOT NULL,
|
||||
status ENUM('open','passed','failed') NOT NULL DEFAULT 'open',
|
||||
answers_sha256 CHAR(64) NULL,
|
||||
correct_count TINYINT UNSIGNED NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
expires_at TIMESTAMP NOT NULL,
|
||||
submitted_at TIMESTAMP NULL DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uq_error_quiz_uuid (uuid),
|
||||
KEY idx_error_quiz_student (student_id,error_id,status),
|
||||
CONSTRAINT fk_error_quiz_error FOREIGN KEY (error_id) REFERENCES student_error_notebook(id) ON DELETE RESTRICT,
|
||||
CONSTRAINT fk_error_quiz_student FOREIGN KEY (student_id) REFERENCES students(id) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
Reference in New Issue
Block a user