Heritage Oaks Inventory — Database Schema Reference

Generated from the live production database. Field-level types, constraints, indexes, foreign keys, and cross-references for every table.

Setup / lookup Operational Audit / history Has RI issues PK primary key FK foreign key UK unique VIRT virtual / generated
High-level relationship diagram — click any table card below to filter the diagram
Referential-integrity issues at a glance
MarkerWhereIssueFix (briefing stage)
⚠️ nullable + SET NULLfinancial_categories.inventory_gl_account_id
cogs_gl_account_id
waste_gl_account_id
The columns nulled by the production bug. ON DELETE SET NULL means hard-deleting a GL nulls these silently; nullable allows the form to overwrite with empty.Stage 3 — backfill from audit log, then NOT NULL + RESTRICT
⚠️ JSON blobfinancial_categories.sales_gl_account_ids
financial_categories.mapped_category_ids
Arrays of FK ids stored as JSON, no constraints. Source of the [16] vs "[\"16\"]" audit log inconsistency.Stage 4 — junction tables
⚠️ free textsizes.quantity_unit, sizes.container_typePlain string columns, no units / container_types lookups. Typos and inconsistencies aren't preventable.Stage 5 — defer
Focused on — showing only this table and its direct relations.