summaryrefslogtreecommitdiff
path: root/internal/database
diff options
context:
space:
mode:
authorGrail Finder (aider) <wohilas@gmail.com>2025-04-05 12:28:35 +0300
committerGrail Finder (aider) <wohilas@gmail.com>2025-04-05 12:28:35 +0300
commita23b77f76f373cd02192117e0ba0aaa389aa9c1a (patch)
tree0dd16fcda68fc5e12f523871a7d64b569d9170ad /internal/database
parentd508685f63107c070b20a9fcc2f63ecbd74a08a6 (diff)
feat: add SQLite schema for quiz questions storage
Diffstat (limited to 'internal/database')
-rw-r--r--internal/database/migrations/002_quiz_schema.down.sql1
-rw-r--r--internal/database/migrations/002_quiz_schema.up.sql17
2 files changed, 18 insertions, 0 deletions
diff --git a/internal/database/migrations/002_quiz_schema.down.sql b/internal/database/migrations/002_quiz_schema.down.sql
new file mode 100644
index 0000000..8f644e8
--- /dev/null
+++ b/internal/database/migrations/002_quiz_schema.down.sql
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS questions;
diff --git a/internal/database/migrations/002_quiz_schema.up.sql b/internal/database/migrations/002_quiz_schema.up.sql
new file mode 100644
index 0000000..406432b
--- /dev/null
+++ b/internal/database/migrations/002_quiz_schema.up.sql
@@ -0,0 +1,17 @@
+CREATE TABLE IF NOT EXISTS questions (
+ id INTEGER PRIMARY KEY,
+ text TEXT NOT NULL,
+ option1 TEXT,
+ option2 TEXT,
+ option3 TEXT,
+ option4 TEXT,
+ correct_index INTEGER NOT NULL,
+ requirement TEXT,
+ explanation TEXT,
+ status INTEGER DEFAULT 0,
+ exam_id INTEGER,
+ mixed_id INTEGER
+);
+
+CREATE INDEX IF NOT EXISTS idx_questions_exam_id ON questions(exam_id);
+CREATE INDEX IF NOT EXISTS idx_questions_mixed_id ON questions(mixed_id);