Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

14 linesCodeBlameRaw
1-- Rewriting the log for a page of `work.migrated` (src/work_items.rs
2-- `MOVED`) finds each of the page's issues' events by its repository and
3-- old number, instead of reading every event of the page's repositories
4-- once per statement: a large repository's log took longer than D1 allows,
5-- and the page was retried for ever. Each index holds only the events the
6-- rewrite looks for, which events written since no longer are (they name
7-- work items), but for comments.
8CREATE INDEX IF NOT EXISTS events_issue_number ON events (repo_id, json_extract(data, '$.number'))
9 WHERE type IN ('issue.opened', 'issue.updated', 'issue.assigned', 'issue.labeled', 'issue.unlabeled', 'issue.milestoned',
10 'issue.demilestoned', 'issue.closed', 'issue.reopened', 'comment.created', 'comment.edited', 'comment.deleted');
11CREATE INDEX IF NOT EXISTS events_issue ON events (repo_id, json_extract(data, '$.issue'))
12 WHERE json_extract(data, '$.issue') IS NOT NULL;
13CREATE INDEX IF NOT EXISTS events_other_issue ON events (repo_id, json_extract(data, '$.otherIssue'))
14 WHERE json_extract(data, '$.otherIssue') IS NOT NULL;