experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 64 lines 2.2 kB view raw
1-- Generated by schema/codegen.js 2-- Schema version: 1 3-- DO NOT EDIT - regenerate with: yarn schema:codegen 4 5-- Unified content storage - URLs, text notes, tagsets, and images 6CREATE TABLE IF NOT EXISTS items ( 7 id TEXT PRIMARY KEY NOT NULL, 8 type TEXT NOT NULL CHECK(type IN ('url', 'text', 'tagset', 'image', 'series', 'feed', 'entity', 'event')), 9 content TEXT, 10 mimeType TEXT DEFAULT '', 11 metadata TEXT DEFAULT '{}', 12 syncId TEXT DEFAULT '', 13 syncedAt INTEGER DEFAULT 0, 14 createdAt INTEGER NOT NULL, 15 updatedAt INTEGER NOT NULL, 16 deletedAt INTEGER DEFAULT 0, 17 starred INTEGER DEFAULT 0, 18 archived INTEGER DEFAULT 0 19); 20 21CREATE INDEX IF NOT EXISTS idx_items_type ON items(type); 22CREATE INDEX IF NOT EXISTS idx_items_syncId ON items(syncId); 23CREATE INDEX IF NOT EXISTS idx_items_deletedAt ON items(deletedAt); 24CREATE INDEX IF NOT EXISTS idx_items_createdAt ON items(createdAt DESC); 25CREATE INDEX IF NOT EXISTS idx_items_starred ON items(starred); 26 27-- Tag definitions with frecency tracking 28CREATE TABLE IF NOT EXISTS tags ( 29 id TEXT PRIMARY KEY NOT NULL, 30 name TEXT NOT NULL UNIQUE, 31 frequency INTEGER DEFAULT 1, 32 lastUsed INTEGER NOT NULL, 33 frecencyScore REAL DEFAULT 0.0, 34 createdAt INTEGER NOT NULL, 35 updatedAt INTEGER NOT NULL 36); 37 38CREATE INDEX IF NOT EXISTS idx_tags_name ON tags(name); 39CREATE INDEX IF NOT EXISTS idx_tags_frecency ON tags(frecencyScore DESC); 40 41-- Junction table linking items to tags 42CREATE TABLE IF NOT EXISTS item_tags ( 43 itemId TEXT NOT NULL, 44 tagId TEXT NOT NULL, 45 createdAt INTEGER NOT NULL 46); 47 48CREATE INDEX IF NOT EXISTS idx_item_tags_itemId ON item_tags(itemId); 49CREATE INDEX IF NOT EXISTS idx_item_tags_tagId ON item_tags(tagId); 50CREATE UNIQUE INDEX IF NOT EXISTS idx_item_tags_unique ON item_tags(itemId, tagId); 51 52-- Events/entries for series and feeds - append-only time-series data 53CREATE TABLE IF NOT EXISTS item_events ( 54 id TEXT PRIMARY KEY NOT NULL, 55 itemId TEXT NOT NULL, 56 content TEXT, 57 value REAL, 58 occurredAt INTEGER NOT NULL, 59 metadata TEXT DEFAULT '{}', 60 createdAt INTEGER NOT NULL 61); 62 63CREATE INDEX IF NOT EXISTS idx_item_events_item_time ON item_events(itemId, occurredAt DESC); 64CREATE INDEX IF NOT EXISTS idx_item_events_occurred ON item_events(occurredAt DESC);