Repository navigation
fix: a refused role drop no longer rolls back the whole apply, and clone writes where --local-url points - #160
Merged
Merged
Conversation
…one writes where --local-url points Roles are server-wide. A role the source lacks can own objects or hold privileges in another database on the target's server, and then DROP ROLE is refused (2BP01) — which rolled back every other fix in the apply, so a sync onto a shared server created nothing. It is now left out like a fix with an unmet dependency: the rest commit, and the error says what to do. Retried with the others, it also succeeds once the same apply's revokes have run, where before a drop ordered ahead of its revoke failed the batch. clone read only the server from --local-url and wrote to --local-db, which defaulted to supaforge_local, so `--local-url …/mydb` cloned somewhere else. And with --local-db naming the URL's own database, --force failed: it tried to drop the database it was connected to. The clone now goes to the database the URL names when --local-db is not given, and creates or drops it from the server's postgres database. 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.
Two issues found while syncing public sample databases (Chinook, AdventureWorks) between local servers and a self-hosted Supabase.
A refused
DROP ROLErolled back every other fixRoles are server-wide. A role the source lacks can still own objects or hold privileges in another database on the target's server, and
DROP ROLEis then refused (2BP01). That one refusal rolled back the whole apply. A sync of Chinook into a fresh database on a shared server created 0 of 11 tables.It's now handled like an unmet dependency: left out, the rest committed, and the error says how to resolve it (
REASSIGN OWNED/DROP OWNEDin each database). Because left-out fixes are retried after the others, a drop ordered ahead of its own revoke now also succeeds.Live, against self-hosted Supabase (PG15), 0.0.39 vs this branch:
USAGEin the target databaseclone --local-url …/mydbcloned somewhere elseclonetook only the server from--local-urland wrote to--local-db, which defaulted tosupaforge_local, so the database the URL named was ignored. And--local-url …/mydb --local-db mydb --forcefailed with "cannot drop the currently open database". Now:--local-dbisn't given (stillsupaforge_localfor a URL namingpostgresor nothing);postgresdatabase.Verified live:
clone --local-url …/clx --force --applyfillsclxand creates nosupaforge_local.Tests
promote-savepoints.test.ts: the classification test, plus a batch test (role drop refused → other fixes committed). Both fail without the change.branch.test.ts: target name and maintenance URL.npm run lint,npm test(1949 passed) andnpm run buildpass.🤖 Generated with Claude Code