internal/store/migrations/0004_api_tokens.up.sql

6521399c1c78577eb00f1bcf8947c0900b9cb62e
gitbay/internal/store/migrations/0004_api_tokens.up.sql

11 lines · 444 bytes

 1CREATE TABLE api_tokens (
 2    id           INTEGER PRIMARY KEY,
 3    user_id      INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
 4    name         TEXT NOT NULL,
 5    token_hash   TEXT NOT NULL UNIQUE,
 6    scope        TEXT NOT NULL DEFAULT 'full' CHECK (scope IN ('full','read')),
 7    created_at   TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
 8    expires_at   TEXT,
 9    last_used_at TEXT,
10    UNIQUE (user_id, name)
11);
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