feat(db): display project name and ID when pushing migrations #4652
+29
−12
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.
What kind of change does this PR introduce?
Feature (UX improvement)
What is the current behavior?
When running
supabase db push, users see a generic prompt without any indication of which project they're pushing to:This can lead to accidentally pushing migrations to the wrong project when working with multiple Supabase projects. Users must rely on checking their
.supabase/project-reffile or runningsupabase linkto verify which project is linked.What is the new behavior?
The command now fetches project details via the Management API and displays the project name and ID before prompting:
Scope:
--linkedflag)--db-url(direct connection string) or--localflags, since there's no linked project in those casesFiles changed:
internal/db/push/push.go- AddedprojectRefparameter andprintProjectInfo()functioncmd/db.go- Passflags.ProjectRefto the push commandinternal/bootstrap/bootstrap.go- Updated call signature (passes empty string for local bootstrap)internal/db/push/push_test.go- Updated tests with new parameterAdditional context
This aligns with the existing behavior of
supabase config push, which already displays project info before making changes:Pushing config to project: abcdefghijklmnopThe implementation uses the existing
V1GetProjectWithResponseAPI call (same pattern used ininternal/link/link.goandinternal/utils/tenant/database.go) to fetch the project name.