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)
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}}
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.
Quick ping check reporting active connection state, active pooler mode, database server version, and roundtrip ping time.
Scaffolds DBAnchor workspace configuration, detects installed ORMs (SQLAlchemy, Django), and sets up starter migration directories if unconfigured.
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.
Generates and prints the exact SQL statements that would be executed for pending migrations without committing transactions.
Displays current applied Alembic revision, count of pending unapplied revisions, and detects any branch head divergence.
Analyzes pending Alembic migrations with AST parsing, calculating table locks, column additions, and risk classifications for each statement.
Visualizes revision ancestry tree in terminal ASCII and provides step-by-step merge commands if multiple heads are detected.
Extracts full table schemas, column types, foreign keys, and indexes from the live PostgreSQL catalog into clean terminal tables or JSON.
Compares Python SQLAlchemy model definitions against live database tables and outputs missing columns, extra columns, and type drift.
Validates DATABASE_URL, checks password character encoding (RFC 3986), tests SSL configuration, and verifies driver compatibility.
Detects cloud database provider (Supabase, Neon, Railway, AWS RDS, GCP Cloud SQL, Docker) and displays provider-specific recommendations.
Inspects an existing unmanaged database schema and generates baseline Alembic initial migration files to bring it under version control safely.
Launches a lightweight local PostgreSQL 17 container in Docker with persistent storage and pre-configured development credentials.
Gracefully shuts down the local Docker PostgreSQL development instance.
Destroys the local development PostgreSQL Docker volume and recreates a fresh database, running all migrations from scratch. Only allowed in local environment.
Prints version metadata for DBAnchor, Python interpreter, active database driver (psycopg/asyncpg), and detected PostgreSQL server version.