-- Members share a whole GitHub repo. Skillfarm reads it, finds every skill folder, and puts each one in the review queue. -- A moderator can deny the whole repo in one step, or approve and deny its skills one by one. CREATE TABLE repo_imports ( id TEXT PRIMARY KEY, user_id TEXT NOT NULL REFERENCES users(id), repo TEXT NOT NULL, -- owner/name as GitHub spells it ref TEXT NOT NULL, -- the commit that was read repo_owner_id TEXT NOT NULL DEFAULT '', -- GitHub's id for the repo owner, to mark a verified owner platforms TEXT NOT NULL, source TEXT NOT NULL DEFAULT 'web', -- web | mcp status TEXT NOT NULL DEFAULT 'reading', -- reading | review | decided found INTEGER NOT NULL DEFAULT 0, decision_note TEXT, -- set when a moderator denies the whole repo decided_by TEXT, decided_at INTEGER, created_at INTEGER NOT NULL, finished_at INTEGER -- when the last skill was read ); CREATE INDEX repo_imports_user ON repo_imports (user_id, created_at); CREATE INDEX repo_imports_status ON repo_imports (status, created_at); CREATE TABLE repo_import_items ( id TEXT PRIMARY KEY, import_id TEXT NOT NULL REFERENCES repo_imports(id), path TEXT NOT NULL, -- the skill folder inside the repo; empty for the repo root files TEXT NOT NULL, -- JSON list of { path, rel, size } read from the repo tree status TEXT NOT NULL DEFAULT 'queued', -- queued | working | submitted | updated | unchanged | skipped | failed detail TEXT, skill_id TEXT, version_id TEXT, started_at INTEGER, created_at INTEGER NOT NULL ); CREATE INDEX repo_import_items_import ON repo_import_items (import_id); CREATE INDEX repo_import_items_status ON repo_import_items (status, created_at); CREATE INDEX repo_import_items_version ON repo_import_items (version_id); -- Comments on a skill. Any signed-in member can leave one; the author or a moderator can remove it. CREATE TABLE comments ( id TEXT PRIMARY KEY, skill_id TEXT NOT NULL REFERENCES skills(id), user_id TEXT NOT NULL REFERENCES users(id), body TEXT NOT NULL, created_at INTEGER NOT NULL, removed_at INTEGER, removed_by TEXT ); CREATE INDEX comments_skill ON comments (skill_id, removed_at, created_at); CREATE INDEX comments_user ON comments (user_id, created_at); ALTER TABLE skills ADD COLUMN comments_count INTEGER NOT NULL DEFAULT 0;