-- Finished-game archive + lightweight stats CREATE TABLE IF NOT EXISTS games ( id TEXT PRIMARY KEY, white_name TEXT, black_name TEXT, result TEXT, -- '1-0', '0-1', '1/2-1/2', '*' reason TEXT, -- checkmate, resign, timeout, draw, stalemate... pgn TEXT, moves INTEGER DEFAULT 0, time_control TEXT, -- e.g. '300+3' or 'unlimited' created_at INTEGER, ended_at INTEGER ); CREATE INDEX IF NOT EXISTS idx_games_created ON games(created_at DESC);