OXYGENHUB
# a22e4aec2e28 oxygenhub / crates / hub / migrations / 0095_runner_updates.sql
1.5 KiB · SQL · last changed Runner updates: policy, test groups and the offer 10 days ago source blame history raw
1
-- Runner updates (oxygenhub#322, OxygenFlow docs/jetstream.md §8.2). The
2
-- policy of the site (scope 'site', key ''), an owner ('owner', its name),
3
-- a test group ('group', its id) or a runner ('runner', its id). A NULL
4
-- inherits from the next level out; the nearest setting wins; off unless
5
-- some level turns updates on.
6
CREATE TABLE runner_update_policies (
7
    scope       TEXT NOT NULL,
8
    key         TEXT NOT NULL,
9
    updates     INTEGER,
10
    -- 'stable', 'canary' or a version.
11
    channel     TEXT,
12
    -- Hours (UTC) in which updates may start: from, to (to may wrap past midnight).
13
    window_from INTEGER,
14
    window_to   INTEGER,
15
    dry_run     INTEGER,
16
    PRIMARY KEY (scope, key)
17
);
18
-- Test groups: named sets of the site's runners (owner '') or one owner's.
19
-- A runner is in one when chosen, or when a stable hash of its id falls in
20
-- the group's percentage, so the same machines are in it every rollout.
21
CREATE TABLE runner_groups (
22
    id         INTEGER PRIMARY KEY,
23
    owner      TEXT NOT NULL,
24
    name       TEXT NOT NULL,
25
    percent    INTEGER,
26
    created_ms INTEGER NOT NULL,
27
    UNIQUE (owner, name)
28
);
29
CREATE TABLE runner_group_members (
30
    group_id  INTEGER NOT NULL REFERENCES runner_groups (id) ON DELETE CASCADE,
31
    runner_id INTEGER NOT NULL REFERENCES flow_runners (id) ON DELETE CASCADE,
32
    PRIMARY KEY (group_id, runner_id)
33
);
34
-- What the runner last said about its update, and when.
35
ALTER TABLE flow_runners ADD COLUMN update_note TEXT NOT NULL DEFAULT '';
36
ALTER TABLE flow_runners ADD COLUMN update_ms INTEGER;