internal/store/migrations/0022_builds.up.sql

00033f022fed6fe0b36e1d7a1e2b3f1df6139ccd
gitbay/internal/store/migrations/0022_builds.up.sql history · blame · raw

17 lines · 761 bytes

 1ALTER TABLE repos ADD COLUMN build_counter INTEGER NOT NULL DEFAULT 0;
 2CREATE TABLE builds (
 3    id          INTEGER PRIMARY KEY,
 4    repo_id     INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
 5    number      INTEGER NOT NULL,
 6    job         TEXT NOT NULL,
 7    sha         TEXT NOT NULL,
 8    ref         TEXT NOT NULL,
 9    steps       TEXT NOT NULL, -- JSON array of shell commands
10    status      TEXT NOT NULL DEFAULT 'pending', -- pending|running|success|failure
11    log         BLOB NOT NULL DEFAULT x'',
12    created_at  TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ','now')),
13    started_at  TEXT NOT NULL DEFAULT '',
14    finished_at TEXT NOT NULL DEFAULT '',
15    UNIQUE (repo_id, number)
16);
17CREATE INDEX builds_pending ON builds(status);