Adds internal/storage/schema.sql and updates README.md with DB schema and dynamic priority calculation strategy. Co-authored-by: StirGpea <stir@openclaw.local> Reviewed-on: #2 Co-authored-by: stirgpea <stjrgpea@wivziv.com> Co-committed-by: stirgpea <stjrgpea@wivziv.com>
25 lines
725 B
SQL
25 lines
725 B
SQL
-- PieVR Database Schema
|
|
|
|
CREATE TABLE IF NOT EXISTS questions (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
type TEXT NOT NULL,
|
|
question_text TEXT NOT NULL,
|
|
payload TEXT NOT NULL,
|
|
active BOOLEAN DEFAULT 1,
|
|
last_asked_at DATETIME,
|
|
streak INTEGER DEFAULT 0,
|
|
times_asked INTEGER DEFAULT 0,
|
|
times_correct INTEGER DEFAULT 0,
|
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS tags (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
name TEXT UNIQUE NOT NULL
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS question_tags (
|
|
question_id INTEGER REFERENCES questions(id) ON DELETE CASCADE,
|
|
tag_id INTEGER REFERENCES tags(id) ON DELETE CASCADE,
|
|
PRIMARY KEY (question_id, tag_id)
|
|
);
|