Skip to content

Document PlanetScale role successors#6932

Open
klaemo wants to merge 1 commit into
anomalyco:devfrom
klaemo:agent/planetscale-role-successor-docs
Open

Document PlanetScale role successors#6932
klaemo wants to merge 1 commit into
anomalyco:devfrom
klaemo:agent/planetscale-role-successor-docs

Conversation

@klaemo

@klaemo klaemo commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Problem

PlanetScale Postgres branch roles can own database objects after an app or migration tool creates or changes schema objects. In branch-per-stage and preview workflows, SST removes non-production resources automatically. If a PostgresBranchRole owns objects and no successor is configured, PlanetScale can reject role deletion during preview cleanup because it does not know which role should receive ownership of those objects.

Representative cleanup failure from a preview stage:

~  Remove
|  Deleted     <dependent resources>
|  Error       <role-resource> planetscale:index:PostgresBranchRole
failure to invoke API: unknown status code returned: Status 422
{"code":"unprocessable","message":"Role is still referenced and cannot be dropped."}

✕  Failed

<role-resource> planetscale:index:PostgresBranchRole
failure to invoke API: unknown status code returned: Status 422
{"code":"unprocessable","message":"Role is still referenced and cannot be dropped."}

Fix

This updates the PlanetScale docs and Postgres examples to model successor: "postgres" on branch roles. The successor gives PlanetScale a role to reassign owned objects to before deleting a temporary branch role.

The docs now call out that runtime-only roles which never own objects do not require a successor, but setting one makes cleanup robust if the role later creates or owns objects.

Changes

  • Add successor: "postgres" to the AWS PlanetScale Drizzle Postgres example.
  • Add successor: "postgres" to the Cloudflare Hyperdrive PlanetScale example.
  • Document why branch-per-stage Postgres roles should configure a successor.

Validation

  • git diff --check
  • bun run typecheck was attempted, but the current checkout fails on pre-existing platform AWS provider type errors before reaching these docs/example changes.

@klaemo klaemo marked this pull request as ready for review July 7, 2026 18:21
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.

1 participant