internal/store/migrations/0071_saved_queries.up.sql

695cb925d1f99f7735883046e455cdc436602cb1
gitbay/internal/store/migrations/0071_saved_queries.up.sql

17 lines · 860 bytes

 1-- A user's named issue and merge request queries (#292). query is the
 2-- canonical text of the query; it is parsed again on every run, and @me
 3-- resolves to whoever runs it. A pinned query shows on the dashboard.
 4CREATE TABLE saved_queries (
 5    id         INTEGER PRIMARY KEY,
 6    user_id    INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
 7    name       TEXT NOT NULL,
 8    query      TEXT NOT NULL,
 9    pinned     INTEGER NOT NULL DEFAULT 0,
10    created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
11    updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
12    UNIQUE (user_id, name)
13);
14
15-- A query reads each table by the repositories it may see, newest first.
16CREATE INDEX issues_repo_created ON issues(repo_id, created_at);
17CREATE INDEX merge_requests_repo_created ON merge_requests(repo_id, created_at);
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form