Postgres is the server data backend — all workflows, processes, agent runs, events, tasks, and secrets live here (ADR-0001). There is no Firestore data layer; Firebase remains only for Auth. These are the devloop notes for working with the local DB.
Zero-to-running setup: GETTING-STARTED.md. Terse
command lookup: dev-quickref.md. pnpm dev starts Postgres
and auto-runs migrations. Migration strategy and rules live in
PLAN-0001 §8.5.
Wipe the data, restart from migrations:
docker compose -f docker-compose.yml -f docker-compose.dev.yml down -v && pnpm dev-v drops the persistent mediforce-dev-pgdata volume; pnpm dev then
recreates the container and re-applies all migrations.
Drizzle's ledger is drizzle.__drizzle_migrations (two underscores):
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec postgres \
psql -U mediforce -d mediforce \
-c 'SELECT id, hash, created_at FROM drizzle.__drizzle_migrations;'Compare against packages/platform-infra/src/postgres/migrations/meta/_journal.json
if you suspect drift.
Edit a schema file under packages/platform-infra/src/postgres/schema/, then:
pnpm db:generateCommit the new NNNN_description.sql plus the journal entry. Re-run
pnpm db:migrate to apply locally. See
PLAN-0001 §10.1 for the
branch-collision rename rule.
TEST_DATABASE_URL=postgresql://mediforce:mediforce@localhost:5432/mediforce \
pnpm --filter @mediforce/platform-infra exec vitest run src/postgresCI runs the same suite (job postgres-repository-tests) plus an L3 API E2E job
(e2e-tests-postgres) exercising the route handler → repo → DB trip.
relation "tool_catalog_entries" does not exist— runpnpm db:migrate.DATABASE_URL is requiredat boot — any non-mock mode needs it (validateEnvininstrumentation-node.tsfails fast).pnpm devwires it automatically; forpnpm dev:no-dockerstart Postgres first or set the URL.pnpm dev:mockis the only mode that runs without it.- Migration applied but table missing — duplicate
idxin_journal.jsonfrom a rebase. See PLAN-0001 §10.1. - Too many connections — bump
POOL_MAXinpackages/platform-infra/src/postgres/client.tsor raise Postgresmax_connections. The pool is shared per process viagetSharedPostgresClient().