Files
vyndr/supabase/migrations/020_ledger_team_opponent.sql

18 lines
865 B
SQL

-- ---------------------------------------------------------------
-- 020 — ledger_entries team/opponent addendum (Session 59, pre-day-one).
--
-- Applied while ledger_entries is still at 0 rows (day one of the public
-- record starts tomorrow) so every row ever written carries the graded
-- player's team + opponent — unblocks VYNDR-on-team with zero backfill.
-- Both are captured from the real feed at write time; null when the feed
-- doesn't identify the player's team (never guessed).
-- ---------------------------------------------------------------
ALTER TABLE public.ledger_entries
ADD COLUMN IF NOT EXISTS team text NULL,
ADD COLUMN IF NOT EXISTS opponent text NULL;
-- VYNDR-on-team aggregate reads (public record scoped by team).
CREATE INDEX IF NOT EXISTS idx_ledger_public_team
ON public.ledger_entries (team) WHERE user_id IS NULL;