Data architecture
PostgreSQL. Prisma schema directory: prisma/schema. There is no single schema.prisma.
| Fact | Observed |
|---|---|
| Models | 135 |
| Enums | 126 |
| Primary keys | @default(uuid(7)) on operational models that were read |
| Timestamps | Timestamptz(3) where declared |
| Tenant key | tenantId plus @@unique([id, tenantId]) on tenant-owned models so child relations can include the tenant |
| Extensions | pgvector in the Compose image. An Embedding model exists |
Status values are Postgres enums. Whether a transition is legal is application code. No trigger definition was found in the schema files that were scanned.
Platform tables that cut across domains
File, AuditLog, OutboxEvent, ProcessedEvent, IdempotencyRecord, SupportTicket, Notification, WebhookEndpoint, Device, Task, Embedding.
Soft delete
Many aggregates have deletedAt. docs/AI_CONTEXT.md says queries must filter deletedAt: null where the column exists. That is a written rule. This documentation does not certify every query.
Idempotency tables
| Mechanism | What it does |
|---|---|
ProcessedEvent | Opt-in record written by IdempotentEventHandlerService |
IdempotencyRecord | Application idempotency model. A global HTTP idempotency interceptor was not found |
StockMovement | @@unique([tenantId, idempotencyKey, createdAt]). Including createdAt means the same key can exist at another timestamp |
| Outbox claim | FOR UPDATE SKIP LOCKED |
Global models
No tenant filter: IntegrationRegistry, Permission, PlatformRolePermission, Currency, FxRate. Everything else that is classified is direct-tenant or indirect-tenant. See Tenancy and Entity map.
Relationships
The operational spine is tenant, seller, channel, order, fulfillment, shipment, and stock by product and warehouse. The diagram is on Relationships.