diff --git a/schema.sql b/schema.sql new file mode 100644 index 0000000..520a59b --- /dev/null +++ b/schema.sql @@ -0,0 +1,20 @@ +-- Bookmarks store. Rows accumulate so the feed keeps tweets even after they +-- scroll out of X's 100-item bookmarks API window. +CREATE TABLE IF NOT EXISTS bookmarks ( + id TEXT PRIMARY KEY, -- tweet id + text TEXT NOT NULL, + author_id TEXT, + username TEXT, + name TEXT, + created_at TEXT, -- ISO 8601 from X + media_urls TEXT, -- JSON array of media URLs + url TEXT, -- permalink + fetched_at INTEGER NOT NULL -- epoch ms when first stored +); +CREATE INDEX IF NOT EXISTS idx_bookmarks_created ON bookmarks(created_at DESC); + +-- Tiny key/value table for OAuth tokens, user id, PKCE verifiers, and last_sync. +CREATE TABLE IF NOT EXISTS meta ( + key TEXT PRIMARY KEY, + value TEXT NOT NULL +);