internal/store/migrations/0043_bookmarks.up.sql

v1.19.0
gitbay/internal/store/migrations/0043_bookmarks.up.sql history · blame · raw

10 lines · 568 bytes

 1-- Bookmarks are a public "saved for later", separate from pins: a pin is
 2-- private quick access to your own work, a bookmark says a repository is
 3-- worth coming back to and its count is a signal of that.
 4CREATE TABLE repo_bookmarks (
 5    user_id      INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
 6    repo_id      INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
 7    bookmarked_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
 8    PRIMARY KEY (user_id, repo_id)
 9);
10CREATE INDEX repo_bookmarks_by_repo ON repo_bookmarks (repo_id);