Products (SKUs)
Finished goods. Produced by work orders, sold via sales orders, and (since #330) sometimes purchased directly via finished-goods POs.
ER diagram
org.skus
| Column | Type | Notes |
|---|---|---|
id | UUID PK | |
org_id | UUID FK | → platform.organizations(id). |
sku_code | VARCHAR(100) | UNIQUE per (org_id, sku_code). |
name | VARCHAR(255) | |
sku_type_id | UUID FK | → org.sku_types(id) ON DELETE RESTRICT. NOT NULL. |
items_per_unit | INTEGER | NOT NULL. Default 1. CHECK ≥ 1. Physical items in a sales unit. |
oz_per_item | NUMERIC(12,6) | Nullable. CHECK ≥ 0. Weight per physical item. |
qbo_id | VARCHAR(100) | UNIQUE per (org_id, qbo_id). QBO sync identifier (SKUs sync as items). |
notes | TEXT | |
is_active | BOOL | NOT NULL. Default true. |
created_at | TIMESTAMPTZ | NOT NULL. Default NOW(). |
updated_at | TIMESTAMPTZ | NOT NULL. Default NOW(). Auto-updated by trigger. |
org.sku_types
Required taxonomic classification. NOT NULL FK from skus.sku_type_id.
| Column | Type | Notes |
|---|---|---|
id | UUID PK | |
org_id | UUID FK | → platform.organizations(id). |
name | VARCHAR(100) | UNIQUE per (org_id, name). |
sort_order | SMALLINT | CHECK >= 0. UNIQUE per (org_id, sort_order) — DEFERRABLE INITIALLY IMMEDIATE for reorders. |
is_active | BOOL | NOT NULL. Default true. |
created_at | TIMESTAMPTZ | NOT NULL. Default NOW(). |
Cross-references
- Output of BOMs: every
bom_items.sku_idis the SKU produced by that BOM. - Input to BOMs: SKUs can be inputs to other SKUs' BOMs via
bom_items.input_sku_id(the FG-as-input pattern, post-#331). - Sold on sales order items.
- Produced via work order items and work order receipt items.
- Purchased on PO items when the parent PO's
target_type = 'finished_goods'. - Anchored on the finished goods inventory ledger.