forge
ExploreLog in

Tahinli/forge

public
0 watching
★ 0
1.5 KiB
1-- Pull request reviews and line comments. Applied by store/migrate.rs.
2-- A review belongs to a pull request (an issues row with kind = 'pull'). Review comments belong
3-- to a review; a comment with reply_to set is a reply in the root comment's thread.
4
5CREATE TABLE pull_reviews (
6 id TEXT PRIMARY KEY, issue_id TEXT NOT NULL REFERENCES issues(id) ON DELETE CASCADE,
7 author_id TEXT NOT NULL REFERENCES users(id),
8 state TEXT NOT NULL, -- pending | commented | approved | changes_requested | dismissed
9 body TEXT NOT NULL DEFAULT '',
10 commit_oid TEXT NOT NULL, -- head at submit (or at creation while pending)
11 dismissed_reason TEXT,
12 created_at TEXT NOT NULL, submitted_at TEXT);
13CREATE INDEX pull_reviews_issue ON pull_reviews(issue_id, submitted_at);
14CREATE TABLE review_comments (
15 id TEXT PRIMARY KEY, issue_id TEXT NOT NULL REFERENCES issues(id) ON DELETE CASCADE,
16 review_id TEXT NOT NULL REFERENCES pull_reviews(id) ON DELETE CASCADE,
17 author_id TEXT NOT NULL REFERENCES users(id),
18 path TEXT NOT NULL, side TEXT NOT NULL, line INTEGER NOT NULL,
19 commit_oid TEXT NOT NULL, diff_hunk TEXT NOT NULL DEFAULT '',
20 reply_to TEXT REFERENCES review_comments(id) ON DELETE CASCADE,
21 body TEXT NOT NULL, outdated INTEGER NOT NULL DEFAULT 0, resolved INTEGER NOT NULL DEFAULT 0,
22 resolved_by TEXT REFERENCES users(id),
23 created_at TEXT NOT NULL, updated_at TEXT NOT NULL);
24CREATE INDEX review_comments_issue ON review_comments(issue_id, path, created_at);