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
| Action | Description |
|---|---|
create | Dump the environment's database to a named snapshot |
list | List all snapshots, grouped by environment if none specified |
restore | Pick a snapshot and restore it (drops and recreates the database) |
delete | Pick a snapshot and permanently delete it |
Flags
| Flag | Description |
|---|---|
-n NAME, --name NAME | Name for the snapshot. Auto-generated if omitted: {env}-{YYYY-MM-DD-HHMM} |
--note NOTE | Optional 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 recordNotes
- 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 dbto relink first. - Snapshots are independent of
cc copy/cc restore(which use a-CC-COPYsuffix instead).
Related
cc db— change or drop the active databasecc copy— lightweight in-place database copycc restore— restore from a CC copy