Skip to content

chore: Supabase baseline migration + security docs - #247

Merged
ChristopherRotnes merged 4 commits into
masterfrom
chore/docs-and-supabase-baseline
May 15, 2026
Merged

ChristopherRotnes merged 4 commits into
masterfrom
chore/docs-and-supabase-baseline

Conversation

@ChristopherRotnes

Copy link
Copy Markdown
Owner

Summary

Changes

  • supabase/migrations/20260101000000_baseline_schema.sql — new baseline (all IF NOT EXISTS)
  • supabase/migrations/20260515_rec_cache_ownership.sql — owner-scoped rec-cache policies
  • supabase/migrations/20260514_… — ADD COLUMN IF NOT EXISTS
  • CHANGELOG.md — [1.5.7] with 7 security items + infra item
  • CLAUDE.md — sportySync JWT auth, rec_cache written_by, prompt XML tags, Supabase preview pitfall
  • README.md — SPORTY_SYNC_API_KEY now health-endpoint-only

Test plan

  • Confirm Supabase Preview check passes on this PR (main validation)
  • Confirm CI (validate job) passes
  • Spot-check CHANGELOG entries are accurate

🤖 Generated with Claude Code

@supabase

supabase Bot commented May 15, 2026 •

Copy link
Copy Markdown

Updates to Preview Branch (chore/docs-and-supabase-baseline) ↗︎

Deployments Status Updated
Database ✅ Fri, 15 May 2026 21:20:13 UTC
Services ✅ Fri, 15 May 2026 21:20:13 UTC
APIs ✅ Fri, 15 May 2026 21:20:13 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations ✅ Fri, 15 May 2026 21:20:15 UTC
Migrations ❌ Fri, 15 May 2026 21:20:18 UTC
Seeding ⏸️ Fri, 15 May 2026 21:20:10 UTC
Edge Functions ⏸️ Fri, 15 May 2026 21:20:10 UTC

❌ Branch Error • Fri, 15 May 2026 21:20:19 UTC

ERROR: relation "user_gyms" does not exist (SQLSTATE 42P01)
At statement: 10
CREATE POLICY "Same-gym users can read profiles"
  ON public.profiles FOR SELECT
  USING (EXISTS (
    SELECT 1 FROM user_gyms ug1
    JOIN user_gyms ug2 ON ug1.sporty_business_unit_id = ug2.sporty_business_unit_id
    WHERE ug1.user_id = auth.uid() AND ug2.user_id = profiles.id
  ))

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

 #236 #242 #247)

- Add 20260101000000_baseline_schema.sql: full idempotent snapshot of all 15
  tables, functions, trigger, grants and RLS policies so Supabase preview
  branches and local db reset work without errors (issue #247)
- Add 20260515_rec_cache_ownership.sql: owner-scoped write policies for
  recommendation_cache, adding written_by column (issue #235; already live)
- Make 20260514 delta idempotent: ADD COLUMN IF NOT EXISTS
- Update CHANGELOG.md with [1.5.7] security + infra entries
- Update CLAUDE.md: sportySync JWT auth, rec_cache written_by, prompt XML
  tags, Supabase preview pitfall (#247)
- Update README.md: SPORTY_SYNC_API_KEY now health-endpoint-only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ChristopherRotnes
ChristopherRotnes force-pushed the chore/docs-and-supabase-baseline branch from 12d12ef to 406fcd4 Compare May 15, 2026 21:12
ChristopherRotnes and others added 3 commits May 15, 2026 23:15
…pat)

CREATE POLICY IF NOT EXISTS is PostgreSQL 17+ only. Supabase preview branches
run PG15/16. Replace every occurrence in the baseline and rec_cache_ownership
migrations with DROP POLICY IF EXISTS + CREATE POLICY (idempotent on PG15+).
Same fix for CREATE TRIGGER IF NOT EXISTS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant