internal/store/migrations/0041_status_skipped.down.sql

98b0b03d448a247f3d4284ddb51fefeea04ecbdd
gitbay/internal/store/migrations/0041_status_skipped.down.sql

24 lines · 1112 bytes

 1ALTER TABLE commit_statuses RENAME TO commit_statuses_old;
 2
 3CREATE TABLE commit_statuses (
 4    id          INTEGER PRIMARY KEY,
 5    repo_id     INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
 6    commit_sha  TEXT NOT NULL,
 7    context     TEXT NOT NULL,
 8    state       TEXT NOT NULL CHECK (state IN ('pending','success','failure','error')),
 9    description TEXT NOT NULL DEFAULT '',
10    target_url  TEXT NOT NULL DEFAULT '',
11    creator_id  INTEGER REFERENCES users(id) ON DELETE SET NULL,
12    created_at  TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
13    updated_at  TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
14    UNIQUE (repo_id, commit_sha, context)
15);
16
17INSERT INTO commit_statuses (id, repo_id, commit_sha, context, state, description, target_url, creator_id, created_at, updated_at)
18    SELECT id, repo_id, commit_sha, context, state, description, target_url, creator_id, created_at, updated_at
19    FROM commit_statuses_old
20    WHERE state != 'skipped';
21
22DROP TABLE commit_statuses_old;
23
24CREATE INDEX commit_statuses_sha ON commit_statuses(repo_id, commit_sha);
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