pr_01m47d24b0e6n91zwymwxg0vpx/services/work/migrations/0010_merge_queue.sql

32 lines1,231 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Agents as a team: lifecycle, merge queue, billing and a new shell1-- Merging through a queue: each pull request is tested together with the
2-- ones ahead of it, and only a combination that passed lands.
3ALTER TABLE repo_settings ADD COLUMN merge_queue INTEGER NOT NULL DEFAULT 0;
4
5CREATE TABLE queue_entries (
6 id TEXT PRIMARY KEY,
7 repo_id TEXT NOT NULL,
8 pull_id TEXT NOT NULL,
9 number INTEGER NOT NULL,
10 -- waiting, testing, passed, failed, landed or removed.
11 state TEXT NOT NULL,
12 -- Who merged it into the queue, as JSON: a member, or g1t by policy.
13 enqueued_by TEXT NOT NULL,
14 keep_issue_open INTEGER NOT NULL DEFAULT 0,
15 -- The pull request's head when its combined state was built.
16 head_commit TEXT,
17 -- The default branch's commit the combined state was built on.
18 base_commit TEXT,
19 -- The numbers of the pull requests merged ahead of it, as JSON.
20 ahead TEXT,
21 -- The tested state, pushed to the branch g1t-queue/<id>.
22 combined_commit TEXT,
23 results TEXT,
24 error TEXT,
25 -- Lets the sandbox testing it, and nothing else, report the result.
26 token_hash TEXT,
27 tested_at TEXT,
28 created_at TEXT NOT NULL,
29 finished_at TEXT
30);
31CREATE INDEX queue_by_repo ON queue_entries (repo_id, state, created_at);
32CREATE INDEX queue_by_pull ON queue_entries (pull_id, state);