OXYGENHUB
# 76fdeedccf44 oxygenhub / crates / hub / migrations / 0057_diffusion_pins.sql
706 B · SQL · last changed Diffusion: the reverse pin index, Used by, and how far behind 23 days ago source blame history raw
1
-- Diffusion (#148, docs/diffusion.md §4.1): the reverse pin index. Each
2
-- Oxygen subrepo pin on a repository's default bookmark, and on the
3
-- bookmark its work lands on, recorded when a push moves that bookmark:
4
-- who consumes which upstream (by the upstream's Oxygen repository id,
5
-- hex), at which heads.
6
CREATE TABLE diffusion_pins (
7
    consumer_id  INTEGER NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
8
    bookmark     TEXT NOT NULL,
9
    path         TEXT NOT NULL,
10
    upstream     TEXT NOT NULL,
11
    heads        TEXT NOT NULL,
12
    updated_ms   INTEGER NOT NULL,
13
    PRIMARY KEY (consumer_id, bookmark, path)
14
);
15
CREATE INDEX diffusion_pins_by_upstream ON diffusion_pins (upstream);