Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: ~>0.173
version: v0.183.0
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
20 changes: 4 additions & 16 deletions cmd/link.go
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
package cmd

import (
"errors"
"fmt"

"github.com/spf13/cobra"
"github.com/supabase/cli/internal/link"
)

var (
useUrl bool
deployDbUrl string

linkCmd = &cobra.Command{
Use: "link",
Short: "Link the current project to a remote deploy database.",
RunE: func(cmd *cobra.Command, args []string) error {
if useUrl {
var deployDbUrl string
fmt.Scanln(&deployDbUrl)
if len(deployDbUrl) == 0 {
return errors.New("Error on `supabase link`: URL is empty.")
}

return link.Link(deployDbUrl)
}

return errors.New("Use `--url` to pass the deploy database URL to link to.")
return link.Link(deployDbUrl)
},
}
)

func init() {
linkCmd.Flags().
BoolVar(&useUrl, "url", false, "Accept Postgres connection string of the deploy database from standard input.")
StringVar(&deployDbUrl, "url", "", "Postgres connection string of the deploy database.")
cobra.CheckErr(linkCmd.MarkFlagRequired("url"))

rootCmd.AddCommand(linkCmd)
}
2 changes: 1 addition & 1 deletion examples/tour/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ supabase init
This will create a `supabase` directory which is managed by the CLI. Then we need to link the current project with the deploy database. Use the connection string from your Supabase project here.

```sh
supabase link --url <<< 'postgresql://postgres:<your_password>@db.<your_project_ref>.supabase.co:5432/postgres'
supabase link --url 'postgresql://postgres:<your_password>@db.<your_project_ref>.supabase.co:5432/postgres'
```

Why do we need to do this? Because if we want to manage a database with a migration tool, we need a _baseline_ where both the migration tool and the database have consistent schemas. `supabase link` does this synchronization between the two.
Expand Down