internal/store/migrations/0056_mr_labels.up.sql

v1.33.0
gitbay/internal/store/migrations/0056_mr_labels.up.sql history · blame · raw

12 lines · 622 bytes

 1-- Labels on merge requests, carried the same way issues carry them
 2-- (#231). The label rows themselves are shared: repo or org scoped.
 3--
 4-- labels now has two child tables, issue_labels and mr_labels: a future
 5-- rebuild of labels must carry both. With foreign keys on, rebuilding a
 6-- parent table drops its children's rows, which is what the first-line
 7-- "-- foreign_keys: off" directive in 0052 is for.
 8CREATE TABLE mr_labels (
 9    mr_id    INTEGER NOT NULL REFERENCES merge_requests(id) ON DELETE CASCADE,
10    label_id INTEGER NOT NULL REFERENCES labels(id) ON DELETE CASCADE,
11    PRIMARY KEY (mr_id, label_id)
12);