| 1 | -- Comments on commits: on the whole commit, or on one line of a file it |
| 2 | -- changed (path and line, a line of the file as the commit left it). |
| 3 | -- Authors are stored as comments' are (author_id, author_name), so an |
| 4 | -- account purged shows as ghost here too. Deleting one removes its row. |
| 5 | CREATE TABLE commit_comments ( |
| 6 | id TEXT PRIMARY KEY, |
| 7 | repo_id TEXT NOT NULL, |
| 8 | -- The commit's full hash, lowercase. |
| 9 | commit_hash TEXT NOT NULL, |
| 10 | path TEXT, |
| 11 | line INTEGER, |
| 12 | author_id TEXT NOT NULL, |
| 13 | author_name TEXT NOT NULL, |
| 14 | -- Markdown, as written. |
| 15 | body TEXT NOT NULL, |
| 16 | created_at TEXT NOT NULL, |
| 17 | updated_at TEXT |
| 18 | ); |
| 19 | -- A commit's comments, oldest first. |
| 20 | CREATE INDEX commit_comments_by_commit ON commit_comments (repo_id, commit_hash, created_at); |
| 21 | -- A repository's, newest first. |
| 22 | CREATE INDEX commit_comments_by_repo ON commit_comments (repo_id, created_at); |