Skip to main content
COMMAND LINE INTERFACE

CLI Command Reference

Search and filter every dbx command, flag, output structure, and safety classification.

Showing 19 of 19 commands
dbx doctor
SAFE / READ-ONLY

Runs a comprehensive, non-destructive 6-layer health diagnostic check: DNS resolution, TCP socket reachability, SSL handshake, authentication, schema permissions, and Alembic migration state.

$ dbx doctor
Provider: Supabase | Engine: PostgreSQL 17 | Status: READY
✓ DNS Resolution (8ms)
✓ TCP Reachability (db.supabase.co:5432)
✓ SSL Handshake (TLSv1.3)
✓ Authentication (postgres)
✓ Schema Permissions (CREATE, ALTER, DROP on public)
✓ Migration System (Alembic synchronized at head: 4a2e19)
dbx doctor --json
SAFE / READ-ONLY

Outputs structured JSON health data with individual latency metrics, detected host topologies, and error details for CI/CD pipelines and automated monitoring tools.

$ dbx doctor --json
{"status": "READY", "provider": "supabase", "latency_ms": 14, "checks": {"dns": true, "tcp": true, "ssl": true, "auth": true, "schema": true, "migrations": true}}
dbx connect
SAFE

Opens an interactive PostgreSQL terminal session (psql or Python REPL) using decoded and validated parameters from DATABASE_URL without exposing passwords in the shell history.

dbx status
SAFE / READ-ONLY

Quick ping check reporting active connection state, active pooler mode, database server version, and roundtrip ping time.

dbx init
SAFE

Scaffolds DBAnchor workspace configuration, detects installed ORMs (SQLAlchemy, Django), and sets up starter migration directories if unconfigured.

dbx migrate
GUARDED BY SAFETY GATE

Applies pending Alembic migrations. If in production, evaluates DDL risk against the Zero Data Loss policy and blocks destructive operations unless --force-destructive is supplied.

dbx migrate --dry-run
SAFE (DRY-RUN)

Generates and prints the exact SQL statements that would be executed for pending migrations without committing transactions.

dbx migration status
SAFE / READ-ONLY

Displays current applied Alembic revision, count of pending unapplied revisions, and detects any branch head divergence.

dbx migration plan
SAFE / READ-ONLY

Analyzes pending Alembic migrations with AST parsing, calculating table locks, column additions, and risk classifications for each statement.

dbx migration explain
SAFE / READ-ONLY

Visualizes revision ancestry tree in terminal ASCII and provides step-by-step merge commands if multiple heads are detected.

dbx schema inspect
SAFE / READ-ONLY

Extracts full table schemas, column types, foreign keys, and indexes from the live PostgreSQL catalog into clean terminal tables or JSON.

dbx schema diff
SAFE / READ-ONLY

Compares Python SQLAlchemy model definitions against live database tables and outputs missing columns, extra columns, and type drift.

dbx config check
SAFE / READ-ONLY

Validates DATABASE_URL, checks password character encoding (RFC 3986), tests SSL configuration, and verifies driver compatibility.

dbx provider detect
SAFE / READ-ONLY

Detects cloud database provider (Supabase, Neon, Railway, AWS RDS, GCP Cloud SQL, Docker) and displays provider-specific recommendations.

dbx adopt
GUARDED

Inspects an existing unmanaged database schema and generates baseline Alembic initial migration files to bring it under version control safely.

dbx local start
LOCAL DEV

Launches a lightweight local PostgreSQL 17 container in Docker with persistent storage and pre-configured development credentials.

dbx local stop
LOCAL DEV

Gracefully shuts down the local Docker PostgreSQL development instance.

dbx local reset
DESTRUCTIVE (LOCAL ONLY)

Destroys the local development PostgreSQL Docker volume and recreates a fresh database, running all migrations from scratch. Only allowed in local environment.

dbx version
SAFE / READ-ONLY

Prints version metadata for DBAnchor, Python interpreter, active database driver (psycopg/asyncpg), and detected PostgreSQL server version.