Skip to content

g1t/services/security/migrations/0004_version_updates.sql

81 lines3,154 bytesCodeBlame
1-- Version updates, from the dependency update file (dependabot.yml,
2-- version 2): when each entry is next checked, the pull requests g1t makes
3-- for them (and for grouped security updates), and the ignore conditions
4-- people set with `@g1t ignore …` comments.
5
6-- One row per `updates` entry, keyed by its id (ecosystem, directories and
7-- target branch). Rows of entries no longer in the file are removed when
8-- it is read again.
9CREATE TABLE update_runs (
10 repo_id TEXT NOT NULL,
11 entry TEXT NOT NULL,
12 -- When it is next checked; null when it is not (an ecosystem g1t does
13 -- not update, `open-pull-requests-limit: 0`, or a file with problems).
14 next_run_at TEXT,
15 last_checked_at TEXT,
16 -- What the last check found, in a sentence, and why it failed if it did.
17 last_result TEXT,
18 last_error TEXT,
19 -- Set while a check runs, so two sweeps do not both take it.
20 running_at TEXT,
21 PRIMARY KEY (repo_id, entry)
22);
23CREATE INDEX update_runs_due ON update_runs (next_run_at);
24
25-- A pull request g1t makes to update dependencies: a version update, or a
26-- security update that a `groups` rule with `applies-to: security-updates`
27-- gathers (security updates for one package stay in `updates`).
28-- kind: version | security
29-- state: requested | open | merged | closed | superseded | needs_code | failed
30CREATE TABLE update_pulls (
31 id TEXT PRIMARY KEY,
32 repo_id TEXT NOT NULL,
33 kind TEXT NOT NULL,
34 entry TEXT NOT NULL,
35 ecosystem TEXT NOT NULL,
36 -- What it is about whatever versions it reaches (a group, or one
37 -- dependency in one directory), and the versions it reaches.
38 subject TEXT NOT NULL,
39 signature TEXT NOT NULL,
40 group_name TEXT,
41 branch TEXT NOT NULL,
42 title TEXT NOT NULL,
43 body TEXT NOT NULL,
44 -- JSON: the dependencies (UpdatedDependency), and the bump it was made
45 -- with, so a rebase makes it again the same way.
46 dependencies TEXT NOT NULL,
47 bump TEXT NOT NULL,
48 -- JSON lists of usernames to assign and to ask for review once it opens.
49 assignees TEXT NOT NULL DEFAULT '[]',
50 reviewers TEXT NOT NULL DEFAULT '[]',
51 state TEXT NOT NULL,
52 pull INTEGER,
53 issue INTEGER,
54 -- The commit g1t last pushed to its branch: another means someone else pushed.
55 head TEXT,
56 -- Who asked for it to merge once its checks pass (`@g1t merge`), as JSON.
57 merge_by TEXT,
58 error TEXT,
59 requested_at TEXT NOT NULL,
60 updated_at TEXT NOT NULL
61);
62CREATE INDEX update_pulls_repo ON update_pulls (repo_id, state);
63CREATE INDEX update_pulls_branch ON update_pulls (repo_id, branch);
64CREATE INDEX update_pulls_pull ON update_pulls (repo_id, pull);
65CREATE INDEX update_pulls_state ON update_pulls (state, updated_at);
66
67-- Dependencies, or some of their versions, skipped because someone said so
68-- in a comment. `condition` is what makes each one: '' for the whole
69-- dependency, else its versions or its update type.
70CREATE TABLE update_ignores (
71 repo_id TEXT NOT NULL,
72 ecosystem TEXT NOT NULL,
73 dependency TEXT NOT NULL,
74 condition TEXT NOT NULL,
75 versions TEXT,
76 update_type TEXT,
77 by TEXT NOT NULL,
78 pull INTEGER,
79 at TEXT NOT NULL,
80 PRIMARY KEY (repo_id, ecosystem, dependency, condition)
81);