Database overview
Schema directory: pnxt-api-nestjs/prisma/schema. 135 models and 126 enums across 24 files. This page is an orientation map, not a column dictionary.
| Fact | Detail |
|---|---|
| Engine | PostgreSQL 16 with pgvector in Compose |
| Access | Prisma 7 through DatabaseService |
| Pooler | PgBouncer for the app. DIRECT_DATABASE_URL for migrations |
| IDs | UUID v7 default on operational models that were read |
| Tenant | tenantId and usually @@unique([id, tenantId]) |
| Soft delete | deletedAt on many aggregates. Filter deletedAt: null where the column exists |
Transition legality is application code. No Postgres trigger was found in the schema files that were scanned.
File index
| File | Domain | Models |
|---|---|---|
00-config.prisma | Reference data, global | 2 |
10-tenant.prisma | Tenancy | 6 |
11-identity.prisma | Identity | 10 |
12-platform.prisma | Files, connections, outbox, audit | 11 |
20-catalog.prisma | Catalog | 5 |
21-channel.prisma | Channel | 6 |
22-partner.prisma | Vendor, courier | 2 |
30-warehouse.prisma | Warehouse | 3 |
31-inventory.prisma | Inventory | 9 |
32-procurement.prisma | Procurement | 7 |
40-customer.prisma | Customer | 4 |
41-order.prisma | Order | 4 |
42-fulfillment.prisma | Fulfillment | 6 |
43-shipment.prisma | Shipping | 6 |
44-return.prisma | Returns | 3 |
50-finance.prisma | Invoice | 13 |
51-settlement.prisma | Settlement | 8 |
52-wallet.prisma | Wallet | 4 |
52-cod-remittance.prisma | COD | 2 |
53-fee-audit.prisma | Fees | 4 |
60-promotion.prisma | Promotion | 3 |
61-notification.prisma | Notifications | 3 |
70-conversation.prisma | 7 | |
71-ai.prisma | AI and voice | 7 |
Counts are model declarations and sum to 135.
Status fields that drive behavior
| Model | Enforced by |
|---|---|
Order.status | Two TypeScript maps |
FulfillmentOrder | fulfillment-state-machine.ts |
ReturnRequest | return-state-machine.ts |
PurchaseOrder | purchase-order-state-machine.ts |
GoodsReceipt | goods-receipt-state-machine.ts |
Channel status | User update versus circuit breaker |
Shipment | Shipment services and courier webhooks |
OutboxEvent | PENDING, PROCESSING, PROCESSED, DEAD |
Full maps: State machines.
Partitioning
PartitionMaintenanceService crons daily at 02:00 and weekly, on the worker. Which tables are partitioned, and the retention rules, were not line-read. Treat them as unknown.