| 1 | -- Decision records: a structured reason for the work being the way it is, |
| 2 | -- with how sure it is: claimed (someone said so), tested (a check or a |
| 3 | -- combination of pull requests proved it) or approved (a person approved). |
| 4 | CREATE TABLE decisions ( |
| 5 | id TEXT PRIMARY KEY, |
| 6 | repo_id TEXT NOT NULL, |
| 7 | issue INTEGER, |
| 8 | pull INTEGER, |
| 9 | session_id TEXT, |
| 10 | -- Who recorded it, by account id and username; NULL for g1t itself. |
| 11 | actor TEXT, |
| 12 | actor_name TEXT, |
| 13 | -- proposal, claim, integration_failure, integration_passed, fix, |
| 14 | -- approval, merge or note. |
| 15 | kind TEXT NOT NULL, |
| 16 | confidence TEXT NOT NULL, |
| 17 | summary TEXT NOT NULL, |
| 18 | -- JSON object: commit, check, combination, other_pulls, suspects. |
| 19 | evidence TEXT NOT NULL DEFAULT '{}', |
| 20 | created_at TEXT NOT NULL |
| 21 | ); |
| 22 | CREATE INDEX decisions_by_issue ON decisions (repo_id, issue, created_at); |
| 23 | CREATE INDEX decisions_by_pull ON decisions (repo_id, pull, created_at); |
| 24 | |
| 25 | -- A combined state that failed while entries ahead of it were still being |
| 26 | -- tested waits for them before it is blamed: what failed, as JSON. |
| 27 | ALTER TABLE queue_entries ADD COLUMN held TEXT; |
| 28 | -- What the queue worked out about a failure: the suspects, and the |
| 29 | -- smaller combinations being built to narrow them down, as JSON. |
| 30 | ALTER TABLE queue_entries ADD COLUMN diagnosis TEXT; |
| 31 | -- 1 for an entry the queue took out: it rejoins once a new commit's |
| 32 | -- checks pass. |
| 33 | ALTER TABLE queue_entries ADD COLUMN requeue INTEGER NOT NULL DEFAULT 0; |
| 34 | |
| 35 | -- Smaller combinations built to find which entries ahead a failed entry |
| 36 | -- breaks with: the default branch, `subset` (the entries ahead, as JSON) |
| 37 | -- and the entry. Built and checked as the queue's own states are, on |
| 38 | -- g1t-queue/<id>, and never landed. |
| 39 | CREATE TABLE queue_probes ( |
| 40 | id TEXT PRIMARY KEY, |
| 41 | repo_id TEXT NOT NULL, |
| 42 | entry_id TEXT NOT NULL, |
| 43 | number INTEGER NOT NULL, |
| 44 | subset TEXT NOT NULL, |
| 45 | -- waiting, testing, passed, failed or stopped. |
| 46 | state TEXT NOT NULL, |
| 47 | token_hash TEXT, |
| 48 | combined_commit TEXT, |
| 49 | error TEXT, |
| 50 | tested_at TEXT, |
| 51 | created_at TEXT NOT NULL, |
| 52 | finished_at TEXT |
| 53 | ); |
| 54 | CREATE INDEX queue_probes_by_repo ON queue_probes (repo_id, state); |
| 55 | CREATE INDEX queue_probes_by_commit ON queue_probes (repo_id, combined_commit); |