Tlapbot/tlapbot/schema.sql
2025-03-10 21:06:40 +01:00

38 lines
838 B
SQL

DROP TABLE IF EXISTS counters;
DROP TABLE IF EXISTS redeem_queue;
DROP TABLE IF EXISTS milestones;
CREATE TABLE IF NOT EXISTS points (
id TEXT PRIMARY KEY,
name TEXT,
points INTEGER
);
CREATE TABLE milestones (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
progress INTEGER NOT NULL,
goal INTEGER NOT NULL
);
CREATE TABLE counters (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
count INTEGER NOT NULL
);
CREATE TABLE redeem_queue (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
redeem TEXT NOT NULL,
redeemer_id TEXT NOT NULL,
note TEXT,
FOREIGN KEY (redeemer_id) REFERENCES points (id)
);
CREATE TABLE polls (
id INTEGER PRIMARY KEY AUTOINCREMENT,
points INTEGER NOT NULL,
option TEXT NOT NULL,
poll_name TEXT NOT NULL,
)