Source: ddx-documentation/adr/0004-database-split.md
Accepted 2026-10-23 (owner Q5, confirmed by Q13).
ddx-api needs six Prisma clients: auth, main, audit, logs, ai, communication. Each should migrate and back up on its own. Evidence: . Version: PostgreSQL 18 ().
One PostgreSQL 18 container (ddx-docker-postgres/, host port 16330, mapping in ) with
one separate database per Prisma client: ddx_auth, ddx_main, ddx_audit,
ddx_logs, ddx_ai, ddx_communication. An init script creates the six databases. Each
client has its own schema.prisma, migration history and DATABASE_URL_*.
One database, one schema per client. Rejected: partial restore needs schema filters, cross-schema joins tempt code past the service layer, and each client still needs its own migration history anyway.
pg_dump -d <db> backs up one domain alone.TenantPrismaService
with the org filter; no $queryRaw (invariant 2).