Compare commits
4 commits
master
...
feature/db
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49c42f76af | ||
|
|
32321e9167 | ||
|
|
0443e8d21d | ||
|
|
03234126ba |
3 changed files with 51 additions and 0 deletions
18
.gitignore
vendored
Normal file
18
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
/bin/
|
||||||
|
/vendor/
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.test
|
||||||
|
*.out
|
||||||
|
/storage/*.db
|
||||||
|
/storage/*.db-journal
|
||||||
|
.env
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
|
@ -1 +1,9 @@
|
||||||
# PieVR
|
# PieVR
|
||||||
|
|
||||||
|
## Database Schema & Core Concepts
|
||||||
|
- **Storage:** SQLite (`storage/` directory, ignored in `.gitignore`).
|
||||||
|
- **Tables:**
|
||||||
|
- `questions`: stores core question data (`id`, `type`, `question_text`, `payload` as JSON, `active`, `last_asked_at`, `streak`, `times_asked`, `times_correct`, `created_at`).
|
||||||
|
- `tags`: tags for granular and cross-cutting topic selection (`id`, `name`).
|
||||||
|
- `question_tags`: many-to-many relationship between questions and tags.
|
||||||
|
- **Priority & Spaced Repetition:** No hardcoded calendar intervals. Priorities and scheduling metrics are stored as raw counters (`streak`, `times_asked`, `last_asked_at`) in the database, while complex priority/decay formulas are calculated dynamically on the fly in Go.
|
||||||
|
|
|
||||||
25
internal/storage/schema.sql
Normal file
25
internal/storage/schema.sql
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
-- 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)
|
||||||
|
);
|
||||||
Loading…
Add table
Reference in a new issue