Repository navigation
feat: migrate create writes the grants on what it makes - #155
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inpublicby default. A table that got its access from the target's defaults would therefore arrive without it.migrate createnow writes every grant the source holds on the objects it creates, under a-- Grantssection in the UP. That includes grants the target's default privileges would have given. The DOWN revokes them.RolesCheckgains anexplicitoption that leaves the default-privilege filter out.syncanddiffbehave 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