Materials
Raw inputs purchased on materials POs and consumed by work orders to produce SKUs.
ER diagram
org.materials
| Column | Type | Notes |
|---|---|---|
id | UUID PK | |
org_id | UUID FK | → platform.organizations(id). |
material_code | VARCHAR(100) | UNIQUE per (org_id, material_code). |
name | VARCHAR(255) | |
material_type_id | UUID FK | → org.material_types(id) ON DELETE RESTRICT. NOT NULL. |
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.material_types
Required taxonomic classification. NOT NULL FK from materials.material_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
- Input to BOMs via
bom_items.material_id. - Purchased on PO items when the parent PO's
target_type = 'materials'(the default). - Anchored on the materials inventory ledger.
- Consumed (event-wise) when WOs progress — see the inventory ledger pages for
CONSUMEsemantics.