-- +goose Up -- Per-account, per-variant best single move: the highest-scoring play the account has -- ever made in each game variant. It exists so the statistics screen can show the word -- itself broken down by variant, not just the dimensionless aggregate -- account_stats.max_word_points. tiles is the move's main word as an ordered JSON array of -- {letter, value, blank} objects (value 0 and blank true for a wildcard), so the client -- renders it as game tiles without needing the variant's alphabet table. score is the -- play's total points (every word it formed plus the all-tiles bonus), matching -- max_word_points. A row is replaced only by a strictly higher-scoring play. It is written -- at game finish alongside account_stats; guest and honest-AI games never record statistics, -- so they never write here. See docs/ARCHITECTURE.md ยง9. SET search_path = backend, pg_catalog; CREATE TABLE account_best_move ( account_id uuid NOT NULL REFERENCES accounts (account_id) ON DELETE CASCADE, variant text NOT NULL, score integer NOT NULL, tiles jsonb NOT NULL, updated_at timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (account_id, variant) ); -- +goose Down SET search_path = backend, pg_catalog; DROP TABLE IF EXISTS account_best_move;