Browse docsMenu

Platform

Data Modeling

How to choose tables versus files, collaborative versus personal state, and record APIs versus SQL.

Table rules

  • Use tables for typed fields, filtering, sorting, structured updates, and workflow state.
  • Use collaborative tables for shared work such as tickets, leads, approvals, claims, and expenses.
  • Use personal RLS tables only when each caller should see only their own rows.
  • Never send created_at, updated_at, or system-managed user_id in record payloads.
  • Use owner_user_id, assignee_user_id, creator_user_id, or reporter_user_id for explicit business ownership.

File rules

  • Use files for contracts, manuals, reports, workflows, screenshots, transcripts, and attachments.
  • Uploading a file does not inject its text into an agent or workflow automatically.
  • Store a stable path or identifier, grant the relevant folder, and make the runtime fetch or search it explicitly.
  • Search indexing is asynchronous, so verify search behavior after upload before relying on it.

Collaborative table

bashcopy
lemma table create --pod-id <pod-id> --payload '{
  "name": "tickets",
  "enable_rls": false,
  "columns": [
    {"name": "title", "type": "TEXT", "required": true},
    {"name": "status", "type": "TEXT", "required": true, "default": "OPEN"},
    {"name": "assignee_user_id", "type": "UUID"}
  ]
}'