From c96e74c54b4f43d1b3f315b2785c61fe6affb36a Mon Sep 17 00:00:00 2001 From: Kev Date: Fri, 10 Jul 2026 22:02:48 -0400 Subject: [PATCH] =?UTF-8?q?Session=2059:=20migration=20020=20=E2=80=94=20l?= =?UTF-8?q?edger=20team/opponent=20(pre-apply=20commit)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../migrations/020_ledger_team_opponent.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 supabase/migrations/020_ledger_team_opponent.sql diff --git a/supabase/migrations/020_ledger_team_opponent.sql b/supabase/migrations/020_ledger_team_opponent.sql new file mode 100644 index 0000000..fb496fc --- /dev/null +++ b/supabase/migrations/020_ledger_team_opponent.sql @@ -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;