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(db diff): add --local flag #1282

Merged
merged 1 commit into from
Jul 5, 2023
Merged

feat(db diff): add --local flag #1282

merged 1 commit into from
Jul 5, 2023

Conversation

soedirgo
Copy link
Member

@soedirgo soedirgo commented Jul 5, 2023

What kind of change does this PR introduce?

feature

What is the current behavior?

supabase db diff defaults to diffing against the local database, but there's no --local flag, which makes it inconsistent with other supabase db subcommands.

What is the new behavior?

Add --local flag (basically a noop vs. the existing behavior).

@soedirgo soedirgo requested a review from a team as a code owner July 5, 2023 06:18
@coveralls
Copy link

Pull Request Test Coverage Report for Build 5461060811

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • 7 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.05%) to 61.9%

Files with Coverage Reduction New Missed Lines %
internal/gen/keys/keys.go 7 7.94%
Totals Coverage Status
Change from base Build 5453307995: -0.05%
Covered Lines: 4671
Relevant Lines: 7546

💛 - Coveralls

Copy link
Member

@thorwebdev thorwebdev left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@soedirgo soedirgo merged commit 603de87 into main Jul 5, 2023
10 checks passed
@soedirgo soedirgo deleted the feat/db-diff-local-flag branch July 5, 2023 07:02
@@ -237,7 +237,10 @@ func init() {
diffFlags.BoolVar(&useMigra, "use-migra", true, "Use migra to generate schema diff.")
diffFlags.BoolVar(&usePgAdmin, "use-pgadmin", false, "Use pgAdmin to generate schema diff.")
dbDiffCmd.MarkFlagsMutuallyExclusive("use-migra", "use-pgadmin")
diffFlags.BoolVar(&linked, "linked", false, "Diffs local schema against the linked project.")
diffFlags.StringVar(&dbUrl, "db-url", "", "Diffs local migration files against the database specified by the connection string (must be percent-encoded).")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already defined as a persistent flag on L228.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, but I couldn't use it as part of MarkFlagsMutuallyExclusive with the global flag

diffFlags.BoolVar(&linked, "linked", false, "Diffs local schema against the linked project.")
diffFlags.StringVar(&dbUrl, "db-url", "", "Diffs local migration files against the database specified by the connection string (must be percent-encoded).")
diffFlags.BoolVar(&linked, "linked", false, "Diffs local migration files against the linked project.")
diffFlags.BoolVar(&local, "local", false, "Diffs local migration files against the local database.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
diffFlags.BoolVar(&local, "local", false, "Diffs local migration files against the local database.")
diffFlags.BoolVar(&local, "local", true, "Diffs local migration files against the local database.")

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah true - will push a fix

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.

4 participants