Product Family
A Product Family is a logical grouping of related products at a Site. Product families are simple directories — they carry a name, code, and optional description, but no production data. All production parameters (standard hours, scrap rates, unit value) live on the products within the family.
Database Table: ops_product_families
| Column | Type | Description |
|---|---|---|
id | UUID (PK) | Auto-generated |
site_id | UUID (FK) | References Site (oee_sites.id) |
family_code | VARCHAR(50) | Short identifier, unique per site |
family_name | VARCHAR(255) | Display name |
description | TEXT | Optional description |
sort_order | INTEGER | Display ordering (default 0) |
created_at | TIMESTAMPTZ | Auto-set on creation |
updated_at | TIMESTAMPTZ | Auto-set on update |
Unique constraint: (site_id, family_code)
Index: site_id
Relationships
- Belongs to a Site (
oee_sites) - Has many Products (
ops_products.family_id) - Referenced by jobs (
ops_jobs.product_family_id) - Has per-station specs via Station Product Standards (
ops_station_product_standards)
Management UI
Product families are managed via the Product Families tab in the OEE Settings modal (gear icon on the OEE dashboard). The tab uses a master-detail layout:
- Left panel: List of families for the selected site
- Right panel: Family detail (name, code, description) plus a list of products in the family
Delete Behavior
A product family cannot be deleted if any of its products are referenced by batches. The product deletion guard fires first, raising an exception (“Cannot delete product — it is referenced by existing batches. Consider marking it inactive instead.”). If no products in the family are referenced by batches, deleting the family hard-deletes the family and all its products.
Note: Families are lightweight grouping containers. All production target fields (standard_hours, default_quantity, target_scrap_rate, unit_value) live on Products, not on families.
Codebase Paths
- Table:
database/sql_scripts/tables/ops_product_families.sql - Functions:
database/sql_scripts/functions/ops/ops_product_family_functions.sql - Backend:
backend/endpoints/ops.ts