Skip to content

Commit f767253

Browse files
authored
MPG Extensions housekeeping (#4501)
* Remove PGVector option from managed Postgres cluster creation * Rename PostGIS flag for cluster creation
1 parent c29a388 commit f767253

File tree

3 files changed

+53
-66
lines changed

3 files changed

+53
-66
lines changed

internal/command/mpg/create.go

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ import (
2121
)
2222

2323
type CreateClusterParams struct {
24-
Name string
25-
OrgSlug string
26-
Region string
27-
Plan string
28-
VolumeSizeGB int
29-
PGVectorEnabled bool
30-
PostGISEnabled bool
24+
Name string
25+
OrgSlug string
26+
Region string
27+
Plan string
28+
VolumeSizeGB int
29+
PostGISEnabled bool
3130
}
3231

3332
// PlanDetails holds the details for each managed postgres plan.
@@ -89,12 +88,7 @@ func newCreate() *cobra.Command {
8988
Default: 10,
9089
},
9190
flag.Bool{
92-
Name: "pgvector",
93-
Description: "Enable PGVector for the Postgres cluster",
94-
Default: false,
95-
},
96-
flag.Bool{
97-
Name: "postgis",
91+
Name: "enable-postgis-support",
9892
Description: "Enable PostGIS for the Postgres cluster",
9993
Default: false,
10094
},
@@ -222,25 +216,23 @@ func runCreate(ctx context.Context) error {
222216
}
223217

224218
params := &CreateClusterParams{
225-
Name: appName,
226-
OrgSlug: slug,
227-
Region: selectedRegion.Code,
228-
Plan: plan,
229-
VolumeSizeGB: flag.GetInt(ctx, "volume-size"),
230-
PGVectorEnabled: flag.GetBool(ctx, "pgvector"),
231-
PostGISEnabled: flag.GetBool(ctx, "postgis"),
219+
Name: appName,
220+
OrgSlug: slug,
221+
Region: selectedRegion.Code,
222+
Plan: plan,
223+
VolumeSizeGB: flag.GetInt(ctx, "volume-size"),
224+
PostGISEnabled: flag.GetBool(ctx, "enable-postgis-support"),
232225
}
233226

234227
uiexClient := uiexutil.ClientFromContext(ctx)
235228

236229
input := uiex.CreateClusterInput{
237-
Name: params.Name,
238-
Region: params.Region,
239-
Plan: params.Plan,
240-
OrgSlug: params.OrgSlug,
241-
Disk: params.VolumeSizeGB,
242-
PGVectorEnabled: params.PGVectorEnabled,
243-
PostGISEnabled: params.PostGISEnabled,
230+
Name: params.Name,
231+
Region: params.Region,
232+
Plan: params.Plan,
233+
OrgSlug: params.OrgSlug,
234+
Disk: params.VolumeSizeGB,
235+
PostGISEnabled: params.PostGISEnabled,
244236
}
245237

246238
response, err := uiexClient.CreateCluster(ctx, input)
@@ -296,7 +288,6 @@ func runCreate(ctx context.Context) error {
296288
fmt.Fprintf(io.Out, " Region: %s\n", params.Region)
297289
fmt.Fprintf(io.Out, " Plan: %s\n", params.Plan)
298290
fmt.Fprintf(io.Out, " Disk: %dGB\n", response.Data.Disk)
299-
fmt.Fprintf(io.Out, " PGVector: %t\n", response.Data.PGVectorEnabled)
300291
fmt.Fprintf(io.Out, " PostGIS: %t\n", response.Data.PostGISEnabled)
301292
fmt.Fprintf(io.Out, " Connection string: %s\n", connectionURI)
302293

internal/command/mpg/mpg_test.go

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -573,26 +573,24 @@ func TestCreateCommand_Logic(t *testing.T) {
573573

574574
return uiex.CreateClusterResponse{
575575
Data: struct {
576-
Id string `json:"id"`
577-
Name string `json:"name"`
578-
Status *string `json:"status"`
579-
Plan string `json:"plan"`
580-
Environment *string `json:"environment"`
581-
Region string `json:"region"`
582-
Organization fly.Organization `json:"organization"`
583-
Replicas int `json:"replicas"`
584-
Disk int `json:"disk"`
585-
IpAssignments uiex.ManagedClusterIpAssignments `json:"ip_assignments"`
586-
PGVectorEnabled bool `json:"pgvector_enabled"`
587-
PostGISEnabled bool `json:"postgis_enabled"`
576+
Id string `json:"id"`
577+
Name string `json:"name"`
578+
Status *string `json:"status"`
579+
Plan string `json:"plan"`
580+
Environment *string `json:"environment"`
581+
Region string `json:"region"`
582+
Organization fly.Organization `json:"organization"`
583+
Replicas int `json:"replicas"`
584+
Disk int `json:"disk"`
585+
IpAssignments uiex.ManagedClusterIpAssignments `json:"ip_assignments"`
586+
PostGISEnabled bool `json:"postgis_enabled"`
588587
}{
589-
Id: expectedCluster.Id,
590-
Name: expectedCluster.Name,
591-
Region: expectedCluster.Region,
592-
Plan: expectedCluster.Plan,
593-
Organization: expectedCluster.Organization,
594-
PGVectorEnabled: false,
595-
PostGISEnabled: false,
588+
Id: expectedCluster.Id,
589+
Name: expectedCluster.Name,
590+
Region: expectedCluster.Region,
591+
Plan: expectedCluster.Plan,
592+
Organization: expectedCluster.Organization,
593+
PostGISEnabled: false,
596594
},
597595
}, nil
598596
},

internal/uiex/managed_postgres.go

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -222,31 +222,29 @@ func (c *Client) CreateUser(ctx context.Context, id string, input CreateUserInpu
222222
}
223223

224224
type CreateClusterInput struct {
225-
Name string `json:"name"`
226-
Region string `json:"region"`
227-
Plan string `json:"plan"`
228-
OrgSlug string `json:"org_slug"`
229-
Disk int `json:"disk"`
230-
PGVectorEnabled bool `json:"pgvector_enabled"`
231-
PostGISEnabled bool `json:"postgis_enabled"`
225+
Name string `json:"name"`
226+
Region string `json:"region"`
227+
Plan string `json:"plan"`
228+
OrgSlug string `json:"org_slug"`
229+
Disk int `json:"disk"`
230+
PostGISEnabled bool `json:"postgis_enabled"`
232231
}
233232

234233
type CreateClusterResponse struct {
235234
Ok bool `json:"ok"`
236235
Errors DetailedErrors `json:"errors"`
237236
Data struct {
238-
Id string `json:"id"`
239-
Name string `json:"name"`
240-
Status *string `json:"status"`
241-
Plan string `json:"plan"`
242-
Environment *string `json:"environment"`
243-
Region string `json:"region"`
244-
Organization fly.Organization `json:"organization"`
245-
Replicas int `json:"replicas"`
246-
Disk int `json:"disk"`
247-
IpAssignments ManagedClusterIpAssignments `json:"ip_assignments"`
248-
PGVectorEnabled bool `json:"pgvector_enabled"`
249-
PostGISEnabled bool `json:"postgis_enabled"`
237+
Id string `json:"id"`
238+
Name string `json:"name"`
239+
Status *string `json:"status"`
240+
Plan string `json:"plan"`
241+
Environment *string `json:"environment"`
242+
Region string `json:"region"`
243+
Organization fly.Organization `json:"organization"`
244+
Replicas int `json:"replicas"`
245+
Disk int `json:"disk"`
246+
IpAssignments ManagedClusterIpAssignments `json:"ip_assignments"`
247+
PostGISEnabled bool `json:"postgis_enabled"`
250248
} `json:"data"`
251249
}
252250

0 commit comments

Comments
 (0)