Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add supabase unlink command #1849

Merged
merged 8 commits into from
Jan 29, 2024

Conversation

eleijonmarck
Copy link
Contributor

NOTE:

  • tests are not ready yet, first I want confirmation that I am heading in the right direction.

What kind of change does this PR introduce?

This introduces a new unlink cmd that unlinks the project set.

What is the current behavior?

We have no way of "unlinking" a project today. This PR makes it so that we clean the .temp file from project-refs.

https://github.com/orgs/supabase/discussions/17991

What is the new behavior?

(2) ~/dev/supabase/cli on main
% go run . link
Selected project ref: <project-ref>
Enter your database password (or leave blank to skip):
Finished supabase link.
(base)
(2) ~/dev/supabase/cli on main took 5s
% go run . unlink
Finished supabase unlink.

cleaned up the .temp files from project-refs with empty string.

(2) ~/dev/supabase/cli/supabase on main
% cd .temp
(base)
(2) ~/dev/supabase/cli/supabase/.temp on main
% ls
gotrue-version  pooler-url  postgres-version  project-ref  rest-version  storage-version
(base)
(2) ~/dev/supabase/cli/supabase/.temp on main
% cat rest-version
(base)
(2) ~/dev/supabase/cli/supabase/.temp on main
% cat project-ref
(base)

Additional context

Add any other context or screenshots.

@eleijonmarck eleijonmarck requested a review from a team as a code owner January 16, 2024 11:42
@sweatybridge
Copy link
Contributor

Thank you for the contribution. This would be a much appreciated feature.

In addition to cleaning the .temp files, we should also purge any saved credentials from the platform native credentials store.

@coveralls
Copy link

coveralls commented Jan 25, 2024

Pull Request Test Coverage Report for Build 7691362763

  • -6 of 24 (75.0%) changed or added relevant lines in 2 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.008%) to 58.763%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/unlink/unlink.go 15 17 88.24%
cmd/unlink.go 3 7 42.86%
Files with Coverage Reduction New Missed Lines %
internal/gen/keys/keys.go 5 11.76%
Totals Coverage Status
Change from base Build 7690958697: 0.008%
Covered Lines: 6159
Relevant Lines: 10481

💛 - Coveralls

@eleijonmarck
Copy link
Contributor Author

@sweatybridge update the tests to confirm and i think this works for me when I unlink using supabase now. Could you test out to unlink a project

@sweatybridge sweatybridge changed the title feat(cmd): supabase unlink feat: add supabase unlink command Jan 29, 2024
Copy link
Contributor

@sweatybridge sweatybridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes to handle missing keys in WSL environments. Thanks for the contribution!

@sweatybridge sweatybridge enabled auto-merge (squash) January 29, 2024 04:56
@sweatybridge sweatybridge merged commit f3f028c into supabase:main Jan 29, 2024
8 checks passed
@eleijonmarck eleijonmarck deleted the eleijonmarck/unlink-cmd branch January 29, 2024 12:03
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.

3 participants