Session 59: migration 020 — ledger team/opponent (pre-apply commit)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kev
2026-07-10 22:02:48 -04:00
parent d296e40cb6
commit c96e74c54b
@@ -0,0 +1,17 @@
-- ---------------------------------------------------------------
-- 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;