skip to content
ccdocs

cc backup

Create and manage named database snapshots for an environment. Snapshots are stored as PostgreSQL custom-format dumps (pg_dump -Fc) and tracked in CC's internal records with metadata.

Backups are stored at: ~/.cc-cli/backups/{env_name}/{timestamp}_{name}.dump

Usage

cc backup create [ENV] [-n NAME] [--note NOTE]
cc backup list   [ENV]
cc backup restore [ENV]
cc backup delete  [ENV]

If no environment is given, CC uses the active environment. If no action is given, CC defaults to list.

Actions

ActionDescription
createDump the environment's database to a named snapshot
listList all snapshots, grouped by environment if none specified
restorePick a snapshot and restore it (drops and recreates the database)
deletePick a snapshot and permanently delete it

Flags

FlagDescription
-n NAME, --name NAMEName for the snapshot. Auto-generated if omitted: {env}-{YYYY-MM-DD-HHMM}
--note NOTEOptional note attached to the snapshot

Examples

cc backup create
# → Dumps active env's DB, auto-names the snapshot

cc backup create my-env -n before-migration --note "clean v17 before upgrade"
# → Named snapshot with a note

cc backup list
# → Lists all snapshots across all environments, grouped by env

cc backup list my-env
# → Lists snapshots for my-env only

cc backup restore my-env
# → Interactive picker → confirm → dropdb + createdb + pg_restore

cc backup delete my-env
# → Interactive picker → confirm → removes file and record

Notes

  • CC will warn if an environment already has 5 or more snapshots when you run create.
  • Restore always targets the same database the snapshot was taken from. To restore into a different database, use cc db to relink first.
  • Snapshots are independent of cc copy / cc restore (which use a -CC-COPY suffix instead).
  • cc db — change or drop the active database
  • cc copy — lightweight in-place database copy
  • cc restore — restore from a CC copy

On this page