Database migration CLI focused on PostgreSQL safety and developer experience.
- Ordered migration system (
.sql,.ts,.js,.py,.go) - Required explicit rollback files
- Safety checks (checksum, ordering, duplicate detection)
--dry-runpreview with SQL and lock warnings- PostgreSQL schema diff (
drift diff --to-url ...) - Migration lint and doctor commands
- Seed support by environment
- Snapshot create/restore via
pg_dumpandpg_restore - Dependency graph output (terminal + JSON)
- Prometheus metrics and OpenTelemetry bootstrap hooks
- npm wrapper with automatic platform binary download
# Wrapper build
bun install
bun run build
# Core build
cd core
go build -o ./bin/drift ./cmd/drift
# Initialize workspace
./bin/drift init
./bin/drift make add_user_indexes
./bin/drift migrate up --dry-rundrift initdrift make <name>drift migrate updrift migrate downdrift migrate rollback <n>drift migrate statusdrift migrate verifydrift migrate doctordrift migrate lintdrift migrate diff --from-url <source_db_url> --to-url <target_db_url>drift migrate diff --to-url <target_db_url> --write --name add_indexesdrift diff --from-url <source_db_url> --to-url <target_db_url>drift seed devdrift seed stagingdrift snapshot createdrift snapshot restore --file <dump>drift graph tables [--json]drift graph migrations [--json]
environment: dev
database:
url: ${DATABASE_URL}
migrations:
dir: ./examples/migrations
safety:
require_confirm_prod: true
readonly_prod: false
prod_fingerprint: ""npx @netpiedev/drift migrate status
bunx @netpiedev/drift migrate statusThe wrapper resolves in this order:
DRIFT_BINARY_PATHif set- local binary candidates (
./core/bin/drift,./bin/drift,./drift) - cached/downloaded binary from GitHub Releases for the current platform
- Clean package boundaries
- Structured logging with
zerolog - SQL execution telemetry (Prometheus + OTel hooks)
- Unit and integration test scaffolding
- CI + release pipelines for Go binaries and npm publish