Adventure Labs Logo
Scout Docs

Chat

Table for storing chat messages between users in herds

Column NameData TypeConstraints
idbigintNOT NULL
created_attimestamp with time zoneDEFAULT now() NOT NULL
messagetextNOT NULL
senderuuid
herd_idbigintNOT NULL

Security Policies (RLS)

RLS enabled. Herd scope: Herd from chat.herd_id.

Operationhas_herd_ability ability keyOther paths
SELECTchat.binaryDevice API key in herd
INSERTchat.binaryDevice API key in herd; user must be sender or null
UPDATE—Device API key in herd, or sender = auth.uid()
DELETE—Device API key in herd, or sender = auth.uid()

Platform superadmin: FOR ALL bypass where defined.

UPDATE/DELETE do not call has_herd_ability.

On this page