Skip to main content

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.

FactDetail
EnginePostgreSQL 16 with pgvector in Compose
AccessPrisma 7 through DatabaseService
PoolerPgBouncer for the app. DIRECT_DATABASE_URL for migrations
IDsUUID v7 default on operational models that were read
TenanttenantId and usually @@unique([id, tenantId])
Soft deletedeletedAt 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​

FileDomainModels
00-config.prismaReference data, global2
10-tenant.prismaTenancy6
11-identity.prismaIdentity10
12-platform.prismaFiles, connections, outbox, audit11
20-catalog.prismaCatalog5
21-channel.prismaChannel6
22-partner.prismaVendor, courier2
30-warehouse.prismaWarehouse3
31-inventory.prismaInventory9
32-procurement.prismaProcurement7
40-customer.prismaCustomer4
41-order.prismaOrder4
42-fulfillment.prismaFulfillment6
43-shipment.prismaShipping6
44-return.prismaReturns3
50-finance.prismaInvoice13
51-settlement.prismaSettlement8
52-wallet.prismaWallet4
52-cod-remittance.prismaCOD2
53-fee-audit.prismaFees4
60-promotion.prismaPromotion3
61-notification.prismaNotifications3
70-conversation.prismaWhatsApp7
71-ai.prismaAI and voice7

Counts are model declarations and sum to 135.

Status fields that drive behavior​

ModelEnforced by
Order.statusTwo TypeScript maps
FulfillmentOrderfulfillment-state-machine.ts
ReturnRequestreturn-state-machine.ts
PurchaseOrderpurchase-order-state-machine.ts
GoodsReceiptgoods-receipt-state-machine.ts
Channel statusUser update versus circuit breaker
ShipmentShipment services and courier webhooks
OutboxEventPENDING, 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.

Next​

Entity map, Relationships, Transactions, Migrations.