Skip to main content

Getting Started

Make sure to first set up your PlanetScale developer environment. Once you’ve installed the pscale CLI, you can interact with PlanetScale and manage your databases straight from the command line.

The move-tables command

Run Vitess MoveTables workflows on a Vitess database branch: copy tables from one keyspace to another, check copy and traffic state, switch reads then writes, and complete or cancel the workflow. JSON output includes a next_steps field with a suggested next command. Use it to see what to run after list or status. Usage:

Available sub-commands

* Flag is required
list also accepts the alias ls. Omit --target-keyspace on list to use the branch’s default keyspace.

Sub-command flag descriptions

Available flags

Global flags

Lifecycle

A typical MoveTables run looks like this:
  1. Create the workflow and wait until copy finishes and streams are Running.
  2. Verify with pscale branch vtctld vdiff create, then vdiff show until it completes with no mismatches. You can skip VDiff and switch replica traffic directly.
  3. Switch replica traffic with --tablet-types REPLICA,RDONLY.
  4. Switch primary traffic with --tablet-types PRIMARY.
  5. Preview cleanup with complete --dry-run, then complete after you review the result.
Use status between steps. traffic_state values are:
  • Reads Not Switched. Writes Not Switched
  • All Reads Switched. Writes Not Switched
  • Reads Not Switched. Writes Switched
  • All Reads Switched. Writes Switched

Examples

List MoveTables workflows and get the next command to run:
Create a workflow:
Check copy and traffic state:
Example status JSON after replica traffic has switched:
Switch replica traffic, then primary traffic:
Verify with VDiff before switching traffic:
Preview cleanup, then complete:

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.