Skip to content

feat: migrate create writes the grants on what it makes - #155

Merged
jasdeepkhalsa merged 1 commit into
mainfrom
feat/explicit-grants-in-migrations
Oct 21, 2026
Merged

jasdeepkhalsa merged 1 commit into
mainfrom
feat/explicit-grants-in-migrations

Conversation

@jasdeepkhalsa

Copy link
Copy Markdown
Member

A migration file is replayed in places whose default privileges can differ from the target it was written against: a new project, a preview branch, a local reset. Supabase no longer grants the Data API roles (anon, authenticated, service_role) on new tables in public by default. A table that got its access from the target's defaults would therefore arrive without it.

  • migrate create now writes every grant the source holds on the objects it creates, under a -- Grants section in the UP. That includes grants the target's default privileges would have given. The DOWN revokes them.
  • RolesCheck gains an explicit option that leaves the default-privilege filter out. sync and diff behave as before: there the target's own defaults are what apply.

Tests: a unit test for the explicit mode, plus an e2e test in which the target's default privileges would grant the table, but the migration file still carries the grant.

🤖 Generated with Claude Code

A migration file is replayed where the default privileges may differ from
the target it was written against: a new project, a preview branch, a local
reset. Supabase no longer grants the Data API roles on new tables in public
by default, so a table whose access came from the target's defaults would
arrive without it. migrate create now writes every grant the source holds
on the objects it creates, even those the target's defaults would give, and
revokes them in the DOWN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jasdeepkhalsa
jasdeepkhalsa merged commit d8420f8 into main Oct 21, 2026
28 checks passed
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