Skip to content

Add pscale branch resize for Postgres branches#1276

Merged
nickvanw merged 2 commits into
mainfrom
nvanwiggeren/postgres-branch-resize
Jun 25, 2026
Merged

Add pscale branch resize for Postgres branches#1276
nickvanw merged 2 commits into
mainfrom
nvanwiggeren/postgres-branch-resize

Conversation

@nickvanw

Copy link
Copy Markdown
Contributor

What

Adds pscale branch resize <database> <branch> --cluster-size <size> to resize a Postgres branch's cluster.

$ pscale branch resize my-db main --cluster-size PS_10_GCP_X86
Resize of branch main to PS-10 started (state: resizing).

It calls the new PostgresBranches.Resize client (planetscale-go v0.171.0), which hits the async branch change-request endpoint PATCH .../branches/{branch}/changes and returns a PostgresClusterResizeRequest. --format json prints the full change request.

MySQL databases are pointed at pscale keyspace resize with a clear error, since the branch-level cluster change endpoint is Postgres-only (the MySQL/Vitess resize stays at the keyspace level).

Notes

  • --cluster-size takes the fully-qualified SKU name as shown by pscale size cluster list (e.g. PS_10_GCP_X86); the API rejects the short PS_10 form for this endpoint.
  • A 204 No Content (config already matches) is surfaced as "already configured with cluster size …".

Testing

  • go build ./... and go test ./... pass.
  • Verified end-to-end against a live Postgres branch (mint-demo): PS-5 → PS-10 → PS-5 round trip completed, and a concurrent call correctly returned "cluster resize in progress".

Dependencies

  • planetscale-go #318 (merged, released as v0.171.0). go.mod/go.sum bumped here.

Adds 'pscale branch resize <database> <branch> --cluster-size <size>',
which resizes a Postgres branch's cluster via the new
PostgresBranches.Resize client (PATCH .../branches/{branch}/changes).

MySQL databases are pointed at 'pscale keyspace resize', since the
branch-level cluster change endpoint is Postgres-only. Bumps
planetscale-go to v0.171.0.
@nickvanw nickvanw requested a review from a team as a code owner June 25, 2026 10:35

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4b2cf7f. Configure here.

Comment thread internal/cmd/branch/resize.go
Comment thread internal/cmd/branch/resize.go
- Complete --cluster-size from the branch's own Postgres SKUs
  (PostgresBranches.ListClusterSKUs), returning the fully-qualified SKU
  names the resize endpoint accepts, instead of org-wide MySQL slugs.
- On a 204 no-op, note it on stderr in non-human formats so scripted
  callers aren't left with completely silent output.

Addresses Bugbot review comments on #1276.
@nickvanw nickvanw merged commit b0ec98f into main Jun 25, 2026
4 checks passed
@nickvanw nickvanw deleted the nvanwiggeren/postgres-branch-resize branch June 25, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants