# Pscale Backup

> Create, list, show, restore, update protected status, and delete branch backups, and manage scheduled backup policies. Use when creating database backups, restoring from backups, protecting or unprotecting backups, managing backup lifecycle, configuring production/development backup schedules, retention, or policy targets. Triggers on backup, restore, database backup, backup branch, protected backup, backup update, backup policy, retention schedule.

- Skill: `vince-winkintel/pscale-backup` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add vince-winkintel/pscale-backup`
- Raw SKILL.md: https://api.skillmd.com/api/skills/vince-winkintel/pscale-backup/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: vince-winkintel (https://skillmd.com/u/vince-winkintel)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/vince-winkintel/pscale-backup

---


# pscale backup

Create, list, show, restore, and delete branch backups; manage scheduled backup policies.

## Common Commands

```bash
# Create backup
pscale backup create <database> <branch>

# List backups
pscale backup list <database> <branch>

# Show backup details
pscale backup show <database> <branch> <backup-id>

# Restore to a new branch; --replicas is PostgreSQL-only
pscale backup restore <database> <new-branch> <backup-id> --cluster-size <size>
pscale backup restore <database> <new-branch> <backup-id> --cluster-size <size> --replicas 2

# Protect or unprotect a backup only after explicit approval
pscale backup update <database> <branch> <backup-id> --protected=true --format json
pscale backup update <database> <branch> <backup-id> --protected=false --format json

# Delete backup
pscale backup delete <database> <branch> <backup-id>

# Inspect scheduled policies
pscale backup policy list <database> --format json
```

## Workflows

### Restore to a new branch

Inspect the source backup and target database first. `--cluster-size` is required for both engines, but valid SKUs are engine-specific: read the database `kind`, then list sizes with `--engine postgresql` for PostgreSQL or `--engine mysql` for Vitess/MySQL. Do not choose from the unfiltered mixed-engine list. Backup-restore `--cluster-size` completion is generic and not database-kind aware, so verify the selected value against the filtered list. For PostgreSQL restores, optional `--replicas` sets the number of **additional** replicas: `0` creates a single-node branch, while omitting the flag uses the selected cluster size's default. The CLI rejects `--replicas` for Vitess/MySQL restores.

```bash
pscale backup show <database> <source-branch> <backup-id> --org <org> --format json
pscale database show <database> --org <org> --format json

# Choose the filter that matches the returned database kind
pscale size cluster list --org <org> --engine postgresql --format json
# pscale size cluster list --org <org> --engine mysql --format json

# Restore and then verify the new branch
pscale backup restore <database> <new-branch> <backup-id> --org <org> \
  --cluster-size <size> --replicas 2 --format json
pscale branch show <database> <new-branch> --org <org> --format json
```

Restoring creates a new branch and can incur capacity cost. Confirm the database, backup ID, new branch name, cluster size, and replica count before execution. Treat the returned branch as provisioning until its readiness fields confirm it can accept connections.

### Backup Before Migration

```bash
# Create backup before schema changes
pscale backup create my-database main

# Proceed with migration
pscale deploy-request deploy my-database 1

# If issues, restore from backup (contact PlanetScale support)
```

### Scheduled backup policies

Policies target either production or development branches and are separate from one-off `backup create` operations. Inspect current policies before writing, and confirm storage-cost implications for custom schedules.

```bash
pscale backup policy list <database> --org <org> --format json

pscale backup policy create <database> --org <org> \
  --target production \
  --frequency-value 1 --frequency-unit day \
  --schedule-time 03:00 \
  --retention-value 30 --retention-unit day \
  --name "daily production"

pscale backup policy show <database> <policy-id> --org <org> --format json
pscale backup policy update <database> <policy-id> --org <org> \
  --retention-value 60 --retention-unit day
```

Frequency units are `hour`, `day`, `week`, or `month`; retention also supports `year`. Weekly/monthly schedules can use `--schedule-day` (`0` Sunday through `6` Saturday), and monthly schedules can use `--schedule-week` (`0` first through `3` fourth). Updates send only supplied flags. Before deleting, show the exact policy, obtain approval, avoid `--force` unless explicitly authorized, and list policies afterward; required system policies cannot be deleted.

### Protect or unprotect a backup

`pscale backup update` toggles whether a backup is protected from deletion. The `--protected` flag is required; use an explicit `=true` or `=false` value so the requested state is clear.

```bash
# Inspect current state first
pscale backup show <database> <branch> <backup-id> --org <org> --format json

# After explicit approval for the exact backup and target state
pscale backup update <database> <branch> <backup-id> --org <org> \
  --protected=true \
  --format json

# Verify persisted protected state
pscale backup show <database> <branch> <backup-id> --org <org> --format json
```

Unprotecting a backup can make later deletion possible. Read back the organization, database, branch, backup ID, current state, requested state, and retention/recovery reason before changing it.

## Related Skills

- **pscale-branch** - Backup specific branches
- **pscale-deploy-request** - Backup before deploying

## References

See `references/commands.md` for complete command reference.

