Skip to content

cwp db

shipped 1.0.0
cwp db [flags]

cwp db groups the commands below and takes no action of its own; run it alone and it prints its help.

FlagWhat it doesDefault
--with-agentwith —dry-run on a host with no shell: install and remove the PHP agent so the plan is realoff
SubcommandWhat it does
cwp db pullBring an environment’s database down (uploads are not included)
cwp db snapshotSnapshot the local database (uploads are not included)
cwp db restoreRestore the local database from a snapshot (uploads are not included)
cwp db listList this project’s snapshots, newest first (uploads are not included)
cwp db rmRemove one snapshot (uploads are not included)
cwp db exportExport the local database to a file (uploads are not included)
cwp db importImport a SQL dump over the local database (uploads are not included)

What it does

cwp db is local database snapshots on top of ddev snapshot, plus dump import and export.

Entirely local. No cwp db subcommand talks to a remote host. This is the half of the safety model that has no backup of its own: the remote database has its host’s backups, and your local one has whatever you took yourself.

Snapshots are database only. A snapshot holds no uploads, and every subcommand’s own description repeats it. Restoring brings back your Bricks layouts, not your media library.

restore and import are the two destructive ones. They carry the same guard as cwp pull: they ask before replacing the local database, and --yes skips the prompt. When cwp cannot prompt, under --json or with no terminal, they refuse with exit 6. Picking a snapshot from the interactive list is the confirmation. cwp does not ask you twice about the same decision.

Snapshot names may contain letters, digits, dot, underscore and hyphen. The name becomes a file under .ddev/db_snapshots/, so cwp refuses anything else rather than passing it on.

Example

cwp db snapshot before-migration
# ... experiment ...
cwp db restore before-migration

What it does not do

It does not snapshot or restore uploads, and it does not touch any remote.

There is no upward database push. cwp db is local. Moving a whole database to a live site is a thing cwp does not do; see Safety.