Skip to content

Commit

Permalink
Remove all branch-level keyspace commands (#924)
Browse files Browse the repository at this point in the history
* Remove all branch-level keyspace commands

* Remove branch-level VSchema commands

* Update planetscale-go and remove deprecated methods
  • Loading branch information
iheanyi authored Oct 14, 2024
1 parent 5a0c49e commit 92e9b7e
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 418 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/pkg/errors v0.9.1
github.com/planetscale/planetscale-go v0.112.0
github.com/planetscale/planetscale-go v0.113.0
github.com/planetscale/psdb v0.0.0-20240109164348-6848e728f6e7
github.com/planetscale/psdbproxy v0.0.0-20241009145102-7fdfa92ae3ca
github.com/spf13/cobra v1.8.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/planetscale/noglog v0.2.1-0.20210421230640-bea75fcd2e8e h1:MZ8D+Z3m2vvqGZLvoQfpaGg/j1fNDr4j03s3PRz4rVY=
github.com/planetscale/noglog v0.2.1-0.20210421230640-bea75fcd2e8e/go.mod h1:hwAsSPQdvPa3WcfKfzTXxtEq/HlqwLjQasfO6QbGo4Q=
github.com/planetscale/planetscale-go v0.112.0 h1:cTuXJrVhO/wh89aKvqxeVeLOgjbDSWcIaf0zEcb58Vg=
github.com/planetscale/planetscale-go v0.112.0/go.mod h1:ldGffCLckkR8fjGDjDFs4WcjlDr8uqg2qRUZhRYBEMI=
github.com/planetscale/planetscale-go v0.113.0 h1:0jYB906v5bn61MncpW+ixA3qroDy8kMuaxmwVBTB20w=
github.com/planetscale/planetscale-go v0.113.0/go.mod h1:ldGffCLckkR8fjGDjDFs4WcjlDr8uqg2qRUZhRYBEMI=
github.com/planetscale/psdb v0.0.0-20240109164348-6848e728f6e7 h1:dxdoFKWVDlV1gq8UQC8NWCofLjCEjEHw47gfeojgs28=
github.com/planetscale/psdb v0.0.0-20240109164348-6848e728f6e7/go.mod h1:WZmi4gw3rOK+ryd1inGxgfKwoFV04O7xBCqzWzv0/0U=
github.com/planetscale/psdbproxy v0.0.0-20241009145102-7fdfa92ae3ca h1:E5E1yyZ03FzA/6styZr5C2L3DdqhnkZsKSJy5q4JnuU=
Expand Down
43 changes: 0 additions & 43 deletions internal/cmd/branch/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ func BranchCmd(ch *cmdutil.Helper) *cobra.Command {
cmd.AddCommand(RefreshSchemaCmd(ch))
cmd.AddCommand(PromoteCmd(ch))
cmd.AddCommand(DemoteCmd(ch))
cmd.AddCommand(VSchemaCmd(ch))
cmd.AddCommand(RoutingRulesCmd(ch))
cmd.AddCommand(KeyspaceCmd(ch))
cmd.AddCommand(SafeMigrationsCmd(ch))
cmd.AddCommand(LintCmd(ch))

Expand Down Expand Up @@ -84,44 +82,3 @@ func toDatabaseBranches(branches []*ps.DatabaseBranch) []*DatabaseBranch {

return bs
}

type DatabaseBranchKeyspace struct {
Name string `header:"name" json:"name"`
Shards int `header:"shards" json:"shards"`
Sharded bool `header:"sharded" json:"sharded"`
CreatedAt int64 `header:"created_at,timestamp(ms|utc|human)" json:"created_at"`
UpdatedAt int64 `header:"updated_at,timestamp(ms|utc|human)" json:"updated_at"`

orig *ps.Keyspace
}

func (d *DatabaseBranchKeyspace) MarshalJSON() ([]byte, error) {
return json.MarshalIndent(d.orig, "", " ")
}

func (d *DatabaseBranchKeyspace) MarshalCSVValue() interface{} {
return []*DatabaseBranchKeyspace{d}
}

// ToDatabaseBranch returns a struct that prints out the various fields of a
// database model.
func ToDatabaseBranchKeyspace(ks *ps.Keyspace) *DatabaseBranchKeyspace {
return &DatabaseBranchKeyspace{
Name: ks.Name,
Shards: ks.Shards,
Sharded: ks.Sharded,
CreatedAt: ks.CreatedAt.UTC().UnixNano() / (int64(time.Millisecond) / int64(time.Nanosecond)),
UpdatedAt: ks.UpdatedAt.UTC().UnixNano() / (int64(time.Millisecond) / int64(time.Nanosecond)),
orig: ks,
}
}

func toDatabaseBranchkeyspaces(keyspaces []*ps.Keyspace) []*DatabaseBranchKeyspace {
bs := make([]*DatabaseBranchKeyspace, 0, len(keyspaces))

for _, ks := range keyspaces {
bs = append(bs, ToDatabaseBranchKeyspace(ks))
}

return bs
}
47 changes: 0 additions & 47 deletions internal/cmd/branch/keyspaces.go

This file was deleted.

67 changes: 0 additions & 67 deletions internal/cmd/branch/keyspaces_test.go

This file was deleted.

171 changes: 0 additions & 171 deletions internal/cmd/branch/vschema.go

This file was deleted.

Loading

0 comments on commit 92e9b7e

Please sign in to comment.