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
23 changes: 23 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,29 @@ Caveats:
- `outliers`/`calls` need `pg_stat_statements` on PostgreSQL; if missing, use `pscale insights queries` instead (no extension needed).
- Rule of thumb: start with `insights` (traffic-aware, historical), use `inspect` for live state (locks, in-flight queries) and physical layout (sizes, bloat, index usage).

## Vitess deploy requests (inspect + throttler)

Core lifecycle is already covered (`list/create/show/diff/review/deploy/apply/edit/cancel/close/revert/skip-revert`). These inspect commands are read-only:

```bash
pscale deploy-request queue <database> --org <org> --format json # database deploy queue (first page)
pscale deploy-request operations <database> <number> --org <org> --format json # per-table schema ops + progress
pscale deploy-request reviews <database> <number> --org <org> --format json # existing reviews (create with review)
pscale deploy-request deployment <database> <number> --org <org> --format json # deployment detail (cutover flags, queue state)
pscale deploy-request storage-check <database> <number> --org <org> --format json # enough_storage / bytes needed
pscale deploy-request throttler show <database> <number> --org <org> --format json # per-DR throttler ratios (not database throttler)
```

Throttler update mutates the deploy request (use after `throttler show`):

```bash
pscale deploy-request throttler update <database> <number> --org <org> --format json --ratio 25
pscale deploy-request throttler update <database> <number> --org <org> --format json \
--configuration main=10 --configuration sharded=40
```

Alias: `pscale dr …` works the same. Vitess only. `--ratio` is 0–95 (0 disables throttling; 95 is slowest). Use either `--ratio` or `--configuration keyspace=ratio`, not both.

## Postgres branch changes (size, replicas, parameters)

`pscale branch resize` queues a single asynchronous **change request** for a Postgres branch covering cluster size, replica count, and configuration parameters in any combination. Track it with `resize status`; cancel it with `resize cancel` while queued.
Expand Down
60 changes: 60 additions & 0 deletions internal/cmd/deployrequest/deployment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package deployrequest

import (
"fmt"
"strconv"

"github.com/planetscale/cli/internal/cmdutil"
"github.com/planetscale/cli/internal/planetscale"
"github.com/planetscale/cli/internal/printer"

"github.com/spf13/cobra"
)

// DeploymentCmd shows the deployment details for a deploy request.
func DeploymentCmd(ch *cmdutil.Helper) *cobra.Command {
cmd := &cobra.Command{
Use: "deployment <database> <number>",
Short: "Show the deployment for a deploy request",
Args: cmdutil.RequiredArgs("database", "number"),
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
database := args[0]
numberStr := args[1]

number, err := strconv.ParseUint(numberStr, 10, 64)
if err != nil {
return fmt.Errorf("the argument <number> is invalid: %s", err)
}

client, err := ch.Client()
if err != nil {
return err
}

end := ch.Printer.PrintProgress(fmt.Sprintf("Fetching deployment for %s/%s",
printer.BoldBlue(database), printer.BoldBlue(number)))
defer end()

deployment, err := client.DeployRequests.GetDeployment(ctx, &planetscale.GetDeploymentRequest{
Organization: ch.Config.Organization,
Database: database,
Number: number,
})
if err != nil {
switch cmdutil.ErrCode(err) {
case planetscale.ErrNotFound:
return fmt.Errorf("deploy request '%s/%s' does not exist in organization %s",
printer.BoldBlue(database), printer.BoldBlue(number), printer.BoldBlue(ch.Config.Organization))
default:
return cmdutil.HandleError(err)
}
}
end()

return ch.Printer.PrintResource(toDeployment(deployment))
},
}

return cmd
}
8 changes: 7 additions & 1 deletion internal/cmd/deployrequest/dr.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,20 @@ func DeployRequestCmd(ch *cmdutil.Helper) *cobra.Command {
cmd.AddCommand(CloseCmd(ch))
cmd.AddCommand(CreateCmd(ch))
cmd.AddCommand(DeployCmd(ch))
cmd.AddCommand(DeploymentCmd(ch))
cmd.AddCommand(DiffCmd(ch))
cmd.AddCommand(EditCmd(ch))
cmd.AddCommand(ForceCutoverCmd(ch))
cmd.AddCommand(ListCmd(ch))
cmd.AddCommand(OperationsCmd(ch))
cmd.AddCommand(QueueCmd(ch))
cmd.AddCommand(ReviewCmd(ch))
cmd.AddCommand(ReviewsCmd(ch))
cmd.AddCommand(ShowCmd(ch))
cmd.AddCommand(RevertCmd(ch))
cmd.AddCommand(SkipRevertCmd(ch))
cmd.AddCommand(StorageCheckCmd(ch))
cmd.AddCommand(ThrottlerCmd(ch))
cmd.AddCommand(RevertCmd(ch))

return cmd
}
Expand Down
Loading