tcb db pg migration fetch
Fetch applied migrations from the remote side into the local directory. All migrations are fetched by default; pass version to fetch a single one.
Usage
# Fetch all remote migrations
tcb db pg migration fetch -e <envId>
# Fetch a single migration
tcb db pg migration fetch <version> -e <envId>
Parameters
| Parameter | Required | Description | Default |
|---|---|---|---|
[version] | No | 14-digit version, all migrations when omitted | — |
-f, --force | No | Overwrite local files with the same name | false |
--dry-run | No | Preview the files to write without writing them | false |
-e, --env-id <envId> | Yes | Environment ID | — |
--json | No | Output JSON | — |
Examples
# First-time onboarding: pull all applied migrations into the local directory
tcb db pg migration fetch -e <envId>
# Fetch a specific version
tcb db pg migration fetch 20260724153000 -e <envId>
# Overwrite local files with the same name, remote wins
tcb db pg migration fetch -e <envId> --force
# Preview the plan without writing files
tcb db pg migration fetch -e <envId> --dry-run
Existing local files are skipped by default; pass --force to overwrite them.
Related Commands
- List migration status
- Repair migration history: sync remote content first when
checksum_mismatchappears