Work / Babul / Wiki / Decisions
schema
Decisionverified 2026-10-23
Schema
Choice: 40 tables in packages/db/prisma/schema.prisma, one migration, no data kept. Rules that must hold:
- Every company row carries
clientId; children's foreign keys includeclientIdandproductId; row-level security per company and per chosen product. - One
Jobtable is the queue for everything slow (capture, verify, analysis, images, export, email), with retries andrunAfter. - One
Changerow per property, in a draft or a commit. One private draft per person per ref. A version is aVersionrow with its bump. - Role passwords are sealed and readable only by the worker. One
AiActionrow per AI call for the meter.
Rejected: the 50-table schema (Kit, Interaction, StyleSection, Tag, Import, CaptureRun, DrawnElement and others) · invoices in our database (Polar keeps them).