| 1 | -- Bookmarks (stars): a user marking a repository. Public on the user's profile, |
| 2 | -- filtered by the viewer's read access when listed. |
| 3 | CREATE TABLE bookmarks ( |
| 4 | id TEXT PRIMARY KEY, |
| 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 BIGINT NOT NULL |
| 8 | ); |
| 9 | CREATE UNIQUE INDEX idx_bookmarks_user_repo ON bookmarks (user_id, repo_id); |
| 10 | CREATE INDEX idx_bookmarks_repo ON bookmarks (repo_id); |