hydra/src/hydra.schema

43 lines
1.5 KiB
Plaintext
Raw Normal View History

create table builds (
id integer primary key autoincrement not null,
timestamp integer not null, -- time this build was added to the db (in Unix time)
jobName text not null,
description text,
drvPath text not null,
outPath text not null,
isCachedBuild integer not null, -- boolean
buildStatus integer, -- 0 = succeeded, 1 = Nix build failure, 2 = positive build failure
errorMsg text, -- error message in case of a Nix failure
startTime integer, -- in Unix time, 0 = used cached build result
stopTime integer
);
create table buildProducts (
buildId integer not null,
type text not null, -- "nix-build", "file", "doc", "report", ...
subtype text not null, -- "sources", "rpm", ...
path text not null,
primary key (buildId, type, subType),
foreign key (buildId) references builds(id) on delete cascade -- ignored by sqlite
);
create table buildLogs (
buildId integer not null,
logPhase text not null,
path text not null,
type text not null,
primary key (buildId, logPhase),
foreign key (buildId) references builds(id) on delete cascade -- ignored by sqlite
);
-- Emulate "on delete cascade" foreign key constraints.
create trigger cascadeBuildDeletion
before delete on builds
for each row begin
delete from buildLogs where buildId = old.id;
delete from buildProducts where buildId = old.id;
end;