+/- table definition

Query

CREATE TABLE cards  (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  trainer_id INTEGER NOT NULL REFERENCES trainers(id) ON DELETE CASCADE,
  student_id INTEGER NOT NULL REFERENCES students(id) ON DELETE CASCADE,
  card_type TEXT NOT NULL,
  -- z. B. '10er'
  total_units INTEGER NOT NULL,
  -- z. B. 10
  used_units INTEGER NOT NULL DEFAULT 0,
  price_cents INTEGER NOT NULL,
  -- 67500 = 675,
  00 
  purchase_date TEXT NOT NULL,
  -- ISO-8601 date
  expires_date TEXT,
  -- ISO-8601 date,
  NULL = unbegrenzt
  status TEXT NOT NULL DEFAULT 'active',
  -- 'active' | 'exhausted' | 'expired' | 'cancelled'
  created_at TEXT NOT NULL DEFAULT (datetime('now'))
)
Use Shift + Up/Down to navigate recently-executed queries