Skip to content

Data Schema & Mappings

Otso keeps the storage model deliberately small. All items are stored as events with normalized content and optional media references.

TableKey fieldsPurpose
eventsid, kind, source, created_at, contentAppend‑only log of everything Otso learns or does.
mediaid, event_id, url, altReferences to local or remote media assets.
tagsevent_id, nameFree‑form tagging for search and organization.
  • commitentry with content.text, url, and author.
  • issue / discussionentry with labels mapped to tags.
  • statusnote with HTML content, media attachments and visibility flag.
  • postnote with AT URI as external_id and facets mapped to tags.

List the latest public notes:

SELECT content->>'text', created_at
FROM events
WHERE kind = 'note' AND visibility = 'public'
ORDER BY created_at DESC
LIMIT 20;

Fetch media for a given event:

SELECT m.url, m.alt
FROM media m
JOIN events e ON m.event_id = e.id
WHERE e.id = $1;