OXYGENHUB
◆ v0.9.22 oxygenhub / crates / hub / migrations / 0010_stars_topics.sql
442 B · SQL · last changed Stars, topics, and a sortable, filterable Explore 1 month ago source blame history raw
1
-- Stars and topics (hub spec §6: explore).
2
CREATE TABLE stars (
3
    account_id INTEGER NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
4
    repo_id    INTEGER NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
5
    at_ms      INTEGER NOT NULL,
6
    PRIMARY KEY (account_id, repo_id)
7
);
8
CREATE INDEX stars_by_repo ON stars (repo_id);
9
-- Space-separated, lower case.
10
ALTER TABLE repositories ADD COLUMN topics TEXT NOT NULL DEFAULT '';