Skip to main content

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​

ParameterRequiredDescriptionDefault
[version]No14-digit version, all migrations when omitted—
-f, --forceNoOverwrite local files with the same namefalse
--dry-runNoPreview the files to write without writing themfalse
-e, --env-id <envId>YesEnvironment ID—
--jsonNoOutput 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.