| name | docker-db-queries |
| description | Volatio database inspection via docker exec psql (volatio-postgres-1, db volatio_market), common queries for tables/enums/hypertables, schema drift checks, fast debug workflow. Use when checking counts, recent rows, missing relations, or TimescaleDB hypertables. |
docker-db-queries
When to Use
- Need to inspect DB state fast (counts, latest rows, schema, enums)
- Debug migrations or missing relations
- Verify Timescale hypertables
- Check schema-database sync before migrations
- Quick data verification during debugging
Golden Path
- Confirm containers are running:
docker compose ps
- Query using docker exec (never host psql):
docker exec volatio-postgres-1 psql -U volatio -d volatio_market -c "SELECT now();"
Common Queries
List All Tables
docker exec volatio-postgres-1 psql -U volatio -d volatio_market -c \
"SELECT table_name FROM information_schema.tables WHERE table_schema='public' ORDER BY 1;"
List All Enums
docker exec volatio-postgres-1 psql -U volatio -d volatio_market -c \
"SELECT typname FROM pg_type WHERE typtype = 'e';"
Row Counts
docker exec volatio-postgres-1 psql -U volatio -d volatio_market -c \
"SELECT COUNT(*) FROM news_articles;"
Recent Rows
docker exec volatio-postgres-1 psql -U volatio -d volatio_market -c \
"SELECT * FROM news_articles ORDER BY created_at DESC LIMIT 5;"
Describe Table Schema
docker exec volatio-postgres-1 psql -U volatio -d volatio_market -c "\d table_name"
Check TimescaleDB Hypertables
docker exec volatio-postgres-1 psql -U volatio -d volatio_market -c \
"SELECT * FROM timescaledb_information.hypertables;"
Check Drizzle Migrations Applied
docker exec volatio-postgres-1 psql -U volatio -d volatio_market -c \
"SELECT * FROM drizzle.__drizzle_migrations ORDER BY created_at;"
Don'ts
- Don't run
psql "$DATABASE_URL" on host - socket/auth issues
- Don't use
bun --eval for DB queries - hangs on connection cleanup
- Don't use
psql -h localhost - use docker exec instead
Why Docker Exec Works
- Runs inside the container where PostgreSQL socket is available
- Uses correct user (
volatio, not postgres)
- No environment variable parsing issues
- Connection cleanup happens in container, not host
Database Details
- Container:
volatio-postgres-1
- User:
volatio
- Database:
volatio_market (NOT volatio)
- Port: 5432