db start
Clone a remote database to local and initialize a migration session.
Usage
postkit db start [--remote <name>]
Options
| Option | Description |
|---|---|
--remote <name> | Use specific remote (otherwise uses default) |
-v, --verbose | Enable verbose output |
--dry-run | Show what would be done without making changes |
--json | Output as JSON |
Examples
# Uses default remote
postkit db start
# Use specific remote
postkit db start --remote staging
What It Does
- Checks prerequisites (pgschema, dbmate installed)
- Resolves target remote (default or specified)
- Tests connection to remote database and detects its PostgreSQL major version
- Checks for pending committed migrations
- If
localDbUrlis empty: Checks Docker availability and starts apostgres:{version}-alpinecontainer on a free port (15432–15532), version-matched to the remote - Clones remote database to local. When using an auto-container, cloning runs via
docker execinside the container (no hostpg_dump/psqlrequired) - Creates a session file (
.postkit/db/session.json) to track state, including thecontainerIDif a container was started
Auto Docker Container
When db.localDbUrl is not set in your secrets file, PostKit automatically:
- Pulls and starts
postgres:{remote-version}-alpine - Uses
docker execto runpg_dump/psqlinside the container (version-matched tools) - Stores the container ID in the session
- Stops and removes the container when you run
postkit db abort