cwp db restore
shipped 1.0.0cwp db restore [name] [flags]
Local only: it acts on no environment.
| Argument | What it is | Default |
|---|---|---|
[name] | snapshot to restore (omit to choose from a list) |
| Flag | What it does | Default |
|---|---|---|
--yes | skip the confirmation prompt | off |
--with-agent | with —dry-run on a host with no shell: install and remove the PHP agent so the plan is real | off |
Plus the shared flags --json, -v, --verbose, -q, --quiet and --dry-run.
What it does
cwp db restore runs ddev snapshot restore <name> and replaces the local
database with a snapshot.
Called with no name, it lists the snapshots newest first and asks which one.
Picking from that list is the confirmation. cwp does not ask you twice
about one decision. Called with a name, it asks you to confirm before
replacing, and --yes skips that.
With --json or no terminal it cannot ask, so it refuses with exit 6 rather than
proceeding on an assumption.
Example
cwp db restore # pick from the list
cwp db restore before-migration
cwp db restore pre-pull-dev-20260728-113000 # undo a pull
What it does not do
Uploads are not restored. Files that arrived with a pull stay as they are; only the database goes back.
It takes no snapshot of what it is about to replace. If the current state matters,
cwp db snapshot first.