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
3 changes: 3 additions & 0 deletions api/overlay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ actions:
- target: $.components.schemas.*.properties.connectionString
description: Removes deprecated field that conflicts with naming convention
remove: true
- target: $.components.schemas.*.properties.region_selection.discriminator
description: Replaces discriminated union with concrete type
remove: true
- target: $.components.schemas.*.properties.private_jwk.discriminator
description: Replaces discriminated union with concrete type
remove: true
Expand Down
3 changes: 2 additions & 1 deletion cmd/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/supabase/cli/internal/utils"
"github.com/supabase/cli/internal/utils/flags"
"github.com/supabase/cli/pkg/api"
"github.com/supabase/cli/pkg/cast"
"golang.org/x/term"
)

Expand Down Expand Up @@ -78,7 +79,7 @@ var (
Name: projectName,
OrganizationId: orgId,
DbPass: dbPassword,
Region: api.V1CreateProjectBodyRegion(region.Value),
Region: cast.Ptr(api.V1CreateProjectBodyRegion(region.Value)),
}
if cmd.Flags().Changed("size") {
body.DesiredInstanceSize = (*api.V1CreateProjectBodyDesiredInstanceSize)(&size.Value)
Expand Down
8 changes: 5 additions & 3 deletions internal/projects/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ func promptMissingParams(ctx context.Context, body *api.V1CreateProjectBody) err
}
fmt.Fprintln(os.Stderr, printKeyValue("Selected org-id", body.OrganizationId))
}
if len(body.Region) == 0 {
if body.Region, err = promptProjectRegion(ctx); err != nil {
if body.Region == nil || len(*body.Region) == 0 {
region, err := promptProjectRegion(ctx)
if err != nil {
return err
}
fmt.Fprintln(os.Stderr, printKeyValue("Selected region", string(body.Region)))
body.Region = &region
fmt.Fprintln(os.Stderr, printKeyValue("Selected region", string(region)))
}
if len(body.DbPass) == 0 {
body.DbPass = flags.PromptPassword(os.Stdin)
Expand Down
5 changes: 3 additions & 2 deletions internal/projects/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import (
"github.com/supabase/cli/internal/testing/apitest"
"github.com/supabase/cli/internal/utils"
"github.com/supabase/cli/pkg/api"
"github.com/supabase/cli/pkg/cast"
)

func TestProjectCreateCommand(t *testing.T) {
var params = api.V1CreateProjectBody{
Name: "Test Project",
OrganizationId: "combined-fuchsia-lion",
DbPass: "redacted",
Region: api.V1CreateProjectBodyRegionUsWest1,
Region: cast.Ptr(api.V1CreateProjectBodyRegionUsWest1),
}

t.Run("creates a new project", func(t *testing.T) {
Expand All @@ -38,7 +39,7 @@ func TestProjectCreateCommand(t *testing.T) {
Id: apitest.RandomProjectRef(),
OrganizationId: params.OrganizationId,
Name: params.Name,
Region: string(params.Region),
Region: string(*params.Region),
CreatedAt: "2022-04-25T02:14:55.906498Z",
})
// Run test
Expand Down
136 changes: 136 additions & 0 deletions pkg/api/client.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading