Skip to content

feat(cli): initialize Vitess databases from the wizard - #1362

Draft
aparajon wants to merge 1 commit into
armand/init-wizardfrom
armand/init-wizard-vitess
Draft

aparajon wants to merge 1 commit into
armand/init-wizardfrom
armand/init-wizard-vitess

Conversation

@aparajon

@aparajon aparajon commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Why

The wizard offered MySQL and PostgreSQL while the README lists Vitess as GA. schemabot init now covers every GA engine, so a Vitess team gets the same guided path to a verified baseline instead of hand-writing server configuration.

What

Choose Vitess, connect the vtgate address, name the PlanetScale organization, and confirm a service token variable, then continue to the state connection as before. Keyspaces are discovered from the main branch through the PlanetScale API, the same source pull uses. The state database is checked and registered as MySQL: Vitess is a target engine, not a storage dialect. Scripts and agents pass the same decisions with --organization, --api-token, and --api-url; the JSON missing_inputs list names them when the engine is Vitess.

engine ── name ── environment ── application connection ✓
                                            │
                          MySQL, PostgreSQL │ Vitess
                              ┌─────────────┴─────────────┐
                              │                           ▼
                              │               PlanetScale organization
                              │                           │
                              │                           ▼
                              │                PlanetScale API token ✓
                              │                           │
                              └─────────────┬─────────────┘
                                            ▼
                          state connection ✓ (MySQL for Vitess)
                                            │
                                            ▼
                 namespaces (keyspaces of main via the PlanetScale API)
                                            │
                                            ▼
                          schema directory ── profile ── review

Steps are now named constants so the two PlanetScale steps can be hidden for other engines, forward and back, without renumbering every reference.

Screens

Engine picker
  SchemaBot  /  connect
  Let’s get your schema ready.
  Database engine
  Which database are you working with?
    MySQL
    Online schema changes with Spirit
    PostgreSQL
    Schema changes with pg-sprite
  › Vitess
    Online schema changes through PlanetScale deploy requests
  ↑/↓ choose · enter continue · esc cancel
Database name for Vitess
  SchemaBot  /  connect
  Let’s get your schema ready.
  Database name
  Use your PlanetScale database name. SchemaBot addresses the database by
  it.
  ›
  enter continue · shift+tab back · esc cancel
PlanetScale organization
  SchemaBot  /  connect
  Let’s get your schema ready.
  PlanetScale organization
  Which PlanetScale organization owns this database?
  ›
  enter continue · shift+tab back · esc cancel
PlanetScale API token, checked
  SchemaBot  /  connect
  Let’s get your schema ready.
  Connect the PlanetScale API
  Use a variable holding a service token as name:value. SchemaBot opens
  deploy requests with it.
  › env:PLANETSCALE_TOKEN
  Token: "abc123"
  Credentials stay in your environment.
  ✓ Connected
  enter continue · shift+tab back · esc cancel
State connection for Vitess
  SchemaBot  /  connect
  Let’s get your schema ready.
  Connect SchemaBot’s state database
  Plans and progress live in a MySQL database of their own, outside
  Vitess.
  › env:SCHEMABOT_STORAGE_DSN
  Host: "localhost:3306"
  Database: "schemabot_state"
  Credentials stay in your environment.
  enter check connection · shift+tab back · esc cancel
Review
  SchemaBot  /  review setup
  Ready when you are
  Your database
  shop · vitess · development
  PlanetScale organization: acme
  Namespaces: commerce
  Your schema files
  schema · profile default
  Connections
  Application: env:DATABASE_URL
  PlanetScale API: env:PLANETSCALE_TOKEN
  SchemaBot state: env:SCHEMABOT_STORAGE_DSN
  We’ll prepare SchemaBot’s state and verify your schema files. We won’t
  change your application’s schema.
  enter connect and verify · shift+tab edit · esc cancel

The recorded demo still shows the two-engine picker; it will be re-recorded once the wizard settles.

How

The PlanetScale check and keyspace discovery are read-only keyspace listings; the token travels only in the request header, and errors show the API error code, never the token or the driver text. Every other guarantee is unchanged: the wizard collects decisions and reads the catalog, and initialize remains the sole path that registers a runtime and initializes state (AZ-7, AZ-8, AZ-9 upheld).

Risk

A Vitess setup needs a PlanetScale service token with access to the database and a MySQL state database. Both are confirmed before anything is registered, and a failed check keeps the wizard open for a retry.

Bigger picture

Stacked on #1334. Next on the stack: creating the state database from the wizard so a first setup needs one connection string.


Generated with Claude Code (Claude Fable 5.1).

The wizard offered MySQL and PostgreSQL while the README lists Vitess as GA.
A Vitess database now has its own path through the same setup: choose Vitess,
connect the vtgate address, name the PlanetScale organization, and confirm a
service token variable, then continue to the state connection. Keyspaces are
discovered from the main branch through the PlanetScale API, the same source
pull uses, and the state database is checked and registered as MySQL because
Vitess is a target engine rather than a storage dialect. Scripts pass the same
decisions with --organization, --api-token, and --api-url.

Steps are now named constants so the two PlanetScale steps can be hidden for
other engines without renumbering every reference.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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