g1t/services/work/migrations/0029_commit_checks.sql
| 1 | -- Checks on commits: check runs and the check suites that group them, |
| 2 | -- reported through the API by integrations, CI and tokens (GitHub's |
| 3 | -- Checks API). g1t Actions' jobs are read as check runs from the actions |
| 4 | -- service and are not kept here. The legacy `check_runs` table holds |
| 5 | -- issues' acceptance checks and is unrelated. |
| 6 | |
| 7 | -- One reporter's check runs on one commit. |
| 8 | CREATE TABLE commit_check_suites ( |
| 9 | id TEXT PRIMARY KEY, |
| 10 | repo_id TEXT NOT NULL, |
| 11 | head_sha TEXT NOT NULL, |
| 12 | head_branch TEXT, |
| 13 | -- Who reported it: a slug and a name for people. |
| 14 | app_slug TEXT NOT NULL, |
| 15 | app_name TEXT NOT NULL, |
| 16 | -- queued, in_progress or completed, from its latest check runs. |
| 17 | status TEXT NOT NULL, |
| 18 | conclusion TEXT, |
| 19 | created_at TEXT NOT NULL, |
| 20 | updated_at TEXT NOT NULL, |
| 21 | UNIQUE (repo_id, head_sha, app_slug) |
| 22 | ); |
| 23 | |
| 24 | CREATE TABLE commit_check_runs ( |
| 25 | id TEXT PRIMARY KEY, |
| 26 | repo_id TEXT NOT NULL, |
| 27 | suite_id TEXT NOT NULL, |
| 28 | head_sha TEXT NOT NULL, |
| 29 | name TEXT NOT NULL, |
| 30 | -- queued, in_progress or completed. |
| 31 | status TEXT NOT NULL, |
| 32 | -- Once completed: success, failure, neutral, cancelled, skipped, |
| 33 | -- timed_out or action_required. |
| 34 | conclusion TEXT, |
| 35 | started_at TEXT, |
| 36 | completed_at TEXT, |
| 37 | details_url TEXT, |
| 38 | external_id TEXT, |
| 39 | -- Its report: Markdown summary and text under a title. |
| 40 | title TEXT, |
| 41 | summary TEXT, |
| 42 | text TEXT, |
| 43 | annotations_count INTEGER NOT NULL DEFAULT 0, |
| 44 | -- The buttons it offers, as a JSON array of { label, description, identifier }. |
| 45 | actions TEXT NOT NULL DEFAULT '[]', |
| 46 | app_slug TEXT NOT NULL, |
| 47 | app_name TEXT NOT NULL, |
| 48 | -- The id of whoever reported it. |
| 49 | created_by TEXT NOT NULL, |
| 50 | created_at TEXT NOT NULL, |
| 51 | updated_at TEXT NOT NULL |
| 52 | ); |
| 53 | CREATE INDEX commit_check_runs_by_commit ON commit_check_runs (repo_id, head_sha); |
| 54 | CREATE INDEX commit_check_runs_by_suite ON commit_check_runs (suite_id); |
| 55 | |
| 56 | -- What a check run says about lines of files, in the order it said it. |
| 57 | CREATE TABLE commit_check_annotations ( |
| 58 | run_id TEXT NOT NULL, |
| 59 | seq INTEGER NOT NULL, |
| 60 | path TEXT NOT NULL, |
| 61 | start_line INTEGER NOT NULL, |
| 62 | end_line INTEGER NOT NULL, |
| 63 | start_column INTEGER, |
| 64 | end_column INTEGER, |
| 65 | -- notice, warning or failure. |
| 66 | annotation_level TEXT NOT NULL, |
| 67 | message TEXT NOT NULL, |
| 68 | title TEXT, |
| 69 | raw_details TEXT, |
| 70 | PRIMARY KEY (run_id, seq) |
| 71 | ); |
| 72 | |
| 73 | -- A check run also stands as a status of its name, so required checks |
| 74 | -- and rulesets' required status checks are met by either alike. Such a |
| 75 | -- status names its check run here, and is listed as that check run only. |
| 76 | ALTER TABLE commit_statuses ADD COLUMN check_run_id TEXT; |