forge
ExploreLog in

Tahinli/forge

public
0 watching
★ 0
447 bytes
1-- Stars: a user's bookmark on a repo. A row goes with either the user or the repo.
2-- The primary key serves "repos starred by a user"; the index serves the per-repo count.
3
4CREATE TABLE stars (
5 user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
6 repo_id TEXT NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
7 created_at TEXT NOT NULL,
8 PRIMARY KEY (user_id, repo_id));
9CREATE INDEX stars_repo_id ON stars(repo_id);