- TournamentService with create-from-template, start, pause, resume, end, cancel - Auto-close when 1 player remains, with CheckAutoClose hook - TournamentState aggregation for WebSocket full-state snapshot - ActivityEntry feed converting audit entries to human-readable items - MultiManager with ListActiveTournaments for lobby view (MULTI-01/02) - ICM calculator: exact Malmuth-Harville for <=10, Monte Carlo for 11+ (FIN-11) - ChopEngine with ICM, chip-chop, even-chop, custom, and partial-chop deals - DealProposal workflow: propose, confirm, cancel with audit trail - Tournament API routes for lifecycle, state, activity, and deal endpoints - deal_proposals migration (007) for storing chop proposals Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 lines
1,017 B
SQL
21 lines
1,017 B
SQL
-- Deal/chop proposals table for tournament end-game scenarios.
|
|
-- Proposals are created, reviewed by the TD, then confirmed or cancelled.
|
|
|
|
CREATE TABLE IF NOT EXISTS deal_proposals (
|
|
id TEXT PRIMARY KEY,
|
|
tournament_id TEXT NOT NULL REFERENCES tournaments(id) ON DELETE CASCADE,
|
|
deal_type TEXT NOT NULL CHECK (deal_type IN (
|
|
'icm', 'chip_chop', 'even_chop', 'custom', 'partial_chop'
|
|
)),
|
|
payouts TEXT NOT NULL DEFAULT '[]', -- JSON array of DealPayout
|
|
total_amount INTEGER NOT NULL DEFAULT 0, -- cents
|
|
is_partial INTEGER NOT NULL DEFAULT 0,
|
|
remaining_pool INTEGER NOT NULL DEFAULT 0, -- cents, for partial chop
|
|
status TEXT NOT NULL DEFAULT 'proposed' CHECK (status IN (
|
|
'proposed', 'confirmed', 'cancelled'
|
|
)),
|
|
created_at INTEGER NOT NULL DEFAULT (unixepoch())
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_deal_proposals_tournament ON deal_proposals(tournament_id);
|
|
CREATE INDEX IF NOT EXISTS idx_deal_proposals_status ON deal_proposals(tournament_id, status);
|