cc db
Manage the database linked to the active environment. Writes cc.database into the editor's settings.json (picked up by launch.json's -d arg via ${config:cc.database}) and links the database in CC's internal records.
Usage
cc db [DB_NAME]
cc db [DB_NAME] --rename NEW_NAME
cc db [DB_NAME] --remove
cc db --link DB_NAME
cc db --unlink DB_NAME
cc db -p
cc db -lIf no database name is provided, CC shows a list of PostgreSQL databases matching the active project name.
Flags
| Flag | Description |
|---|---|
-l, --list | List all tracked databases with size and last login |
--rename NEW_NAME | Rename the database in CC's internal records |
--remove | Drop the PostgreSQL database and remove it from CC records |
--extend | Push expiration date to 2099 and disable the update cron |
--link DB_NAME | Add a database to the current environment's pool without making it active |
--unlink DB_NAME | Remove a database from the current environment's pool |
-p, --pool | When prompting, show only databases in the current environment's pool |
-y, --yes | Skip confirmation prompt |
Database Pool
Each environment can have a pool of databases linked to it. The pool lets you keep multiple databases associated with one environment (e.g. clean, test, prod-copy) and switch between them easily.
cc db --link staging_copy— adds to the pool without changing the active databasecc db --unlink old_db— removes from the poolcc db -p— shows a picker filtered to only pool databases
The active database (referenced by launch.json via ${config:cc.database}) is separate from the pool — linking doesn't change what runs. Use cc db <name> to make a pool database active.
Workspaces
Databases are scoped to environments, not workspaces. However, since environments belong to projects and projects belong to workspaces, the database pool naturally inherits workspace/version grouping. When you cc switch to a project in a workspace, the environment's active database and pool are immediately available.
Examples
cc db my_project_v17
# → Sets cc.database in settings.json to my_project_v17, links it to the active env
cc db
# → Shows interactive list of matching databases to choose from
cc db -p
# → Shows only databases in the current environment's pool
cc db --link staging_copy
# → Adds staging_copy to the pool without changing the active DB
cc db old_name --rename new_name
# → Renames the record in CC (does not rename the PostgreSQL database)
cc db old_db --remove
# → Drops the PostgreSQL database after confirmation