cwp db
shipped 1.0.0cwp db [flags]
cwp db groups the commands below and takes no action of its own; run it alone and it prints its help.
| Flag | What it does | Default |
|---|---|---|
--with-agent | with —dry-run on a host with no shell: install and remove the PHP agent so the plan is real | off |
| Subcommand | What it does |
|---|---|
cwp db pull | Bring an environment’s database down (uploads are not included) |
cwp db snapshot | Snapshot the local database (uploads are not included) |
cwp db restore | Restore the local database from a snapshot (uploads are not included) |
cwp db list | List this project’s snapshots, newest first (uploads are not included) |
cwp db rm | Remove one snapshot (uploads are not included) |
cwp db export | Export the local database to a file (uploads are not included) |
cwp db import | Import 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.