skip to content
ccdocs
Commandscc db

cc db restore

Restore a PostgreSQL database from its cc copy (<db_name>-CC-COPY). The original database is dropped and recreated from the copy.

Usage

cc db restore <name>
cc db restore              # detect the DB from the active environment

Arguments

ArgumentDescription
nameDatabase to restore (tab-completable). If omitted, cc detects it from the version path's settings.json / launch.json.

What it does

  • Routed through the daemon (direct connection or docker exec): it verifies the <name>-CC-COPY template exists in live Postgres before dropping the target, then CREATE DATABASE … TEMPLATE the copy. Works on a dockerized Postgres too.
  • You must run cc db copy first. If no copy exists, the command aborts before touching the target.

Examples

cc db restore my_project_v17
# → Drops my_project_v17, restores from my_project_v17-CC-COPY

cc db restore
# → Detects the DB from the active environment and restores it

On this page