Open iafisher opened 3 years ago
Proposed schema:
CREATE TABLE quizzes(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT UNIQUE NOT NULL CHECK(name != ''),
);
CREATE TABLE questions(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
quiz INTEGER NOT NULL REFERENCES quizzes,
text TEXT NOT NULL CHECK(text != ''),
ordered BOOLEAN NOT NULL DEFAULT 0,
);
CREATE TABLE answers(
question INTEGER NOT NULL REFERENCES questions,
text TEXT NOT NULL CHECK(text != ''),
correct BOOLEAN NOT NULL DEFAULT 1,
no_credit BOOLEAN NOT NULL DEFAULT 0,
);
Each table will also have a created_at
column.
I should also have a drill_version
singleton table to make backwards compatibility easier.
This would let me combine the quiz files, which use a custom format, and the results files, which are in JSON, into a single file, and a ton of logic devoted to parsing the custom format could be deleted.
The downside is that I would have to write tools to be able to view and edit the quizzes. I think
drill --list
to print out the quiz,drill --edit <id>
to edit a question,drill --add
to add a question, anddrill --delete <id>
would be sufficient.