Adventure Labs Logo
Scout Docs

Parts

Device- or herd-scoped hardware parts with serial and product numbers

Column NameData TypeConstraints
idbigintNOT NULL
created_attimestamp with time zoneDEFAULT now() NOT NULL
device_idbigintFK -> devices
herd_idbigintFK -> herds
serial_numbertextNOT NULL
product_numbertextNOT NULL, FK -> product_numbers
certificate_idbigintFK -> certificates
primary_calibration_idbigintFK -> calibrations
healthpublic.health_itemDEFAULT 'healthy' NOT NULL
updated_attimestamp with time zoneDEFAULT now()
lifecyclepublic.entity_lifecycleDEFAULT 'active' NOT NULL
lifecycle_changed_attimestamp with time zoneDEFAULT timezone('utc'::text, now()) NOT NULL
lifecycle_changed_byuuid
lifecycle_reasontext

Exactly one of device_id or herd_id is set (parts_exactly_one_scope).

Security Policies (RLS)

RLS enabled. Herd scope: COALESCE(parts.herd_id, get_herd_id_by_device_id(parts.device_id)).

Operationhas_herd_ability ability keyOther paths
SELECTdevices.readDevice API key (own or herd)
INSERTdevices.writeOwning device API key
UPDATEdevices.writeOwning device API key
DELETEdevices.writeOwning device API key

Platform superadmin: FOR ALL bypass where defined.

On this page