Data Schema & Mappings
Otso keeps the storage model deliberately small. All items are stored as events with normalized content and optional media references.
Minimal schemas
Section titled “Minimal schemas”| Table | Key fields | Purpose | 
|---|---|---|
events | id, kind, source, created_at, content | Append‑only log of everything Otso learns or does. | 
media | id, event_id, url, alt | References to local or remote media assets. | 
tags | event_id, name | Free‑form tagging for search and organization. | 
Mapping examples
Section titled “Mapping examples”GitHub
Section titled “GitHub”commit→entrywithcontent.text,url, andauthor.issue/discussion→entrywith labels mapped to tags.
Mastodon
Section titled “Mastodon”status→notewith HTML content, media attachments and visibility flag.
Bluesky
Section titled “Bluesky”post→notewith AT URI asexternal_idand facets mapped to tags.
Query snippets
Section titled “Query snippets”List the latest public notes:
SELECT content->>'text', created_atFROM eventsWHERE kind = 'note' AND visibility = 'public'ORDER BY created_at DESCLIMIT 20;Fetch media for a given event:
SELECT m.url, m.altFROM media mJOIN events e ON m.event_id = e.idWHERE e.id = $1;