internal/store/migrations/0047_mentions.up.sql

3c0c20da787d91bcad19aec3b5e1b5c4ac5a4745
gitbay/internal/store/migrations/0047_mentions.up.sql history · blame · raw

11 lines · 550 bytes

 1-- Who an issue or merge request body, or a comment on one, mentioned by
 2-- @name. A mentioned account is a participant of the thread from then
 3-- on, the way an author or commenter is (#202). repo_id carries the
 4-- cascade, since item_id is polymorphic.
 5CREATE TABLE mentions (
 6    repo_id INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
 7    kind    TEXT NOT NULL CHECK (kind IN ('issue', 'mr')),
 8    item_id INTEGER NOT NULL,
 9    user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
10    PRIMARY KEY (kind, item_id, user_id)
11);