1---
2title: Backups & restores
3description: Restore a PlanetScale backup into a fresh branch with backupId, or seed a new branch from the last successful backup with seedData.
4---
5
6Alchemy doesn't manage PlanetScale backup schedules — create backups
7in the PlanetScale dashboard or via the API. What it gives you is the
8restore side: point a new branch at a backup and it comes up with that
9backup's schema and data.
10
11Both `MySQLBranch` and `PostgresBranch` accept the same two props:
12`backupId` restores a specific backup, `seedData` restores the parent
13branch's last successful backup.
14
15## Restore a branch from a backup
16
17Pass the backup's ID as `backupId`. `clusterSize` is required when
18restoring from a backup:
19
20```typescript
21const restored = yield* Planetscale.MySQLBranch("restored", {
22 database,
23 parentBranch: "main",
24 isProduction: true,
25 backupId: "backup-123",
26 clusterSize: "PS_10",
27});
28```
29
30The branch is created from `parentBranch` with the backup's schema and
31data restored into it, then waits until it's ready like any other
32branch. Grab the ID from the backup's page in the PlanetScale
33dashboard or the backups API, and make sure the backup has completed
34(state `success`) before deploying.
35
36## Seed from the last successful backup
37
38When you don't care which backup — just "recent production data" —
39use `seedData` instead of pinning an ID:
40
41```typescript
42const preview = yield* Planetscale.MySQLBranch("preview", {
43 database,
44 parentBranch: "main",
45 isProduction: false,
46 seedData: "last_successful_backup",
47});
48```
49
50This is the usual choice for preview and development branches that
51want realistic data without tracking backup IDs in code.
52
53## Create-only semantics
54
55Both props apply only when the branch is first created. If the branch
56already exists, `backupId` and `seedData` are ignored — subsequent
57deploys sync the branch's other settings (production status,
58`clusterSize`, `safeMigrations`) but never re-restore data. Changing
59`backupId` on a deployed branch is a no-op, not a replacement.
60
61To restore again, create a new branch: give the resource a new logical
62ID (or a new `name`) so the next deploy creates a fresh branch from
63the backup.
64
65## Where next
66
67- [MySQL](/planetscale/data/mysql) — databases, branches, and passwords.
68- [Postgres](/planetscale/data/postgres) — the PostgreSQL side, including
69 roles.
70- [Migrations](/planetscale/data/migrations) — schema migrations and seed
71 files per branch.
72
73Reference:
74
75- [MySQLBranch](/providers/planetscale/mysql/mysqlbranch) ·
76 [PostgresBranch](/providers/planetscale/postgres/postgresbranch)