Skip to content

cwp db restore

shipped 1.0.0
cwp db restore [name] [flags]

Local only — it acts on no environment.

ArgumentWhat it isDefault
[name]snapshot to restore (omit to choose from a list)
FlagWhat it doesDefault
--yesskip the confirmation promptoff

Plus the shared flags --json, --verbose and --dry-run.

What it does

Runs ddev snapshot restore <name>, replacing 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 — you are not asked twice about one decision. Called with a name, it confirms 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.