Getting Started
Make sure to first set up your PlanetScale developer environment. Once you’ve installed thepscale
CLI, you can interact with PlanetScale and manage your databases straight from the command line.
The backup
command
This command allows you to create, list, show, and delete branch backups.
Usage:
Available sub-commands
Sub-command | Description | Product |
---|---|---|
create <DATABASE_NAME> <BRANCH_NAME> | Backup a branch’s data and schema | Postgres, Vitess |
delete <DATABASE_NAME> <BRANCH_NAME> <BACKUP_ID> | Delete a branch backup | Postgres, Vitess |
list <DATABASE_NAME> <BRANCH_NAME> | List all backups of a branch | Postgres, Vitess |
restore <DATABASE_NAME> <BRANCH_NAME> <BACKUP_ID> | Restore a backup to a new branch | Postgres, Vitess |
show <DATABASE_NAME> <BRANCH_NAME> <BACKUP_ID> | Show a specific backup of a branch | Postgres, Vitess |
Available flags
Flag | Description |
---|---|
-h , --help | View help for backup command |
--org <ORGANIZATION_NAME> | The organization for the current user |
Global flags
Command | Description |
---|---|
--api-token <TOKEN> | The API token to use for authenticating against the PlanetScale API. |
--api-url <URL> | The base URL for the PlanetScale API. Default is https://api.planetscale.com/ . |
--config <CONFIG_FILE> | Config file. Default is $HOME/.config/planetscale/pscale.yml . |
--debug | Enable debug mode. |
-f , --format <FORMAT> | Show output in a specific format. Possible values: human (default), json , csv . |
--no-color | Disable color output. |
--service-token <TOKEN> | The service token for authenticating. |
--service-token-id <TOKEN_ID> | The service token ID for authenticating. |
Examples
The list
sub-command with --org
flag
Command:
The show
sub-command
Command:
<BACKUP_ID>
by running the pscale backup list <DATABASE_NAME> <BRANCH_NAME>
command.
Output: