21 lines · 769 B
-- Instance-wide settings an admin can change at runtime (signup cap, ...).
CREATE TABLE instance_settings (
  key TEXT PRIMARY KEY,
  value TEXT NOT NULL,
  updated_at INTEGER NOT NULL
);

-- People waiting for a seat while signups are at the cap. A row with an invite holds a seat until the
-- invite expires (then it is deleted and the next person is invited) or the person signs up. Line order is `id`
-- (AUTOINCREMENT, so it is strict and never reused).
CREATE TABLE signup_waitlist (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  email TEXT NOT NULL COLLATE NOCASE UNIQUE,
  created_at INTEGER NOT NULL,
  invite_token_hash TEXT UNIQUE,
  invited_at INTEGER,
  invite_expires_at INTEGER
);

CREATE INDEX signup_waitlist_expiry ON signup_waitlist(invite_expires_at);