db deploy
Deploy committed migrations to a remote database with dry-run verification.
Usage
postkit db deploy [--remote <name>] [--url <url>] [-f] [--dry-run]
Options
| Option | Description |
|---|---|
--remote <name> | Use specific remote (otherwise uses default) |
--url <url> | Direct URL override |
-f | Skip confirmation prompts |
--dry-run | Verify only, don't touch target |
-v, --verbose | Enable verbose output |
--json | Output as JSON |
Examples
# Uses default remote
postkit db deploy
# Use specific remote
postkit db deploy --remote staging
# Dry run to verify
postkit db deploy --remote production --dry-run
# Skip confirmations
postkit db deploy --remote staging -f
What It Does
- Resolves the target database URL (from remote config or
--urlflag) - If an active session exists, removes it (with confirmation unless
-f) - Tests the target database connection
- Clones the target database to local (using
LOCAL_DATABASE_URL) - Runs a full dry-run on the local clone: infra, dbmate migrate, grants, seeds
- If
--dry-runis set, stops here and reports results - Reports dry-run results and confirms deployment (unless
-f) - Applies to target: infra, dbmate migrate, grants, seeds
- Drops the local clone database
- Marks migrations as deployed in
.postkit/db/committed.json
If the dry run fails, deployment is aborted and no changes are made to the target database.
Requirements
- Committed migrations must exist (run
db commitfirst) - PostgreSQL client tools must be installed