feat: redesign match play and add broadcast tooling

This commit is contained in:
2026-09-29 02:52:56 +00:00
parent f417a831f7
commit 9b9aafefc1
348 changed files with 31588 additions and 11094 deletions

View File

@@ -0,0 +1,20 @@
-- Optimistic locking for the match actor, the hosting IRC account for
-- rejoining after a restart, and an undo log for rating changes.
ALTER TABLE match ADD COLUMN IF NOT EXISTS revision integer NOT NULL DEFAULT 0;
ALTER TABLE match ADD COLUMN IF NOT EXISTS irc_account text;
CREATE TABLE IF NOT EXISTS rating_change (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
match_id uuid NOT NULL REFERENCES match(id) ON DELETE CASCADE,
subject text NOT NULL,
subject_id text NOT NULL,
before integer NOT NULL,
after integer NOT NULL,
won boolean NOT NULL,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_rating_change_match ON rating_change (match_id);
CREATE INDEX IF NOT EXISTS idx_rating_change_subject ON rating_change (subject_id);
-- Matches the previous process left mid-flight are resumed by the runtime.
CREATE INDEX IF NOT EXISTS idx_match_game_match_state ON match_game (match_id, state);