hydra/src/hydra.sql

162 lines
5.4 KiB
MySQL
Raw Normal View History

2008-11-11 12:54:37 +00:00
-- This table contains all builds, either scheduled or finished. For
-- scheduled builds, additional info (such as the priority) can be
-- found in the BuildSchedulingInfo table. For finished builds,
-- additional info (such as the logs, build products, etc.) can be
-- found in several tables, such as BuildResultInfo, BuildLogs and
-- BuildProducts.
create table Builds (
id integer primary key autoincrement not null,
2008-11-11 12:54:37 +00:00
finished integer not null, -- 0 = scheduled, 1 = finished
timestamp integer not null, -- time this build was scheduled / finished building
2008-11-04 18:23:28 +00:00
-- Info about the inputs.
project text not null, -- !!! foreign key
2008-11-10 10:18:50 +00:00
jobset text not null, -- !!! foreign key
2008-11-04 18:23:28 +00:00
attrName text not null,
-- Info about the build result.
description text,
drvPath text not null,
outPath text not null,
2008-11-11 12:54:37 +00:00
system text not null,
foreign key (project) references Projects(name), -- ignored by sqlite
foreign key (project, jobset) references Jobsets(project, name) -- ignored by sqlite
);
-- Info for a scheduled build.
create table BuildSchedulingInfo (
id integer primary key not null,
priority integer not null default 0,
busy integer not null default 0, -- true means someone is building this job now
locker text not null default '', -- !!! hostname/pid of the process building this job?
logfile text, -- if busy, the path of the logfile
foreign key (id) references Builds(id) on delete cascade -- ignored by sqlite
);
-- Info for a finished build.
create table BuildResultInfo (
id integer primary key not null,
isCachedBuild integer not null, -- boolean
2008-11-11 12:54:37 +00:00
buildStatus integer, -- 0 = succeeded, 1 = Nix build failure, 2 = positive build failure
2008-11-11 12:54:37 +00:00
errorMsg text, -- error message in case of a Nix failure
2008-11-11 12:54:37 +00:00
startTime integer, -- in Unix time, 0 = used cached build result
2008-11-06 18:26:29 +00:00
stopTime integer,
2008-11-10 10:18:50 +00:00
2008-11-11 12:54:37 +00:00
foreign key (id) references Builds(id) on delete cascade -- ignored by sqlite
);
2008-11-11 12:54:37 +00:00
-- Inputs of builds.
create table BuildInputs (
2008-11-09 00:48:36 +00:00
id integer primary key autoincrement not null,
2008-11-11 12:54:37 +00:00
-- Which build this input belongs to.
2008-11-09 00:48:36 +00:00
build integer,
2008-11-10 10:18:50 +00:00
-- Copied from the jobsetinputs from which the build was created.
name text not null,
type text not null,
uri text,
revision integer,
tag text,
2008-11-06 18:26:29 +00:00
value text,
2008-11-09 00:48:36 +00:00
dependency integer, -- build ID of the input, for type == 'build'
2008-11-06 18:26:29 +00:00
path text,
2008-11-11 12:54:37 +00:00
foreign key (build) references Builds(id) on delete cascade, -- ignored by sqlite
foreign key (dependency) references Builds(id) -- ignored by sqlite
);
2008-11-11 12:54:37 +00:00
create table BuildProducts (
2008-11-09 00:48:36 +00:00
build integer not null,
2008-11-08 22:40:12 +00:00
path text not null,
type text not null, -- "nix-build", "file", "doc", "report", ...
subtype text not null, -- "source-dist", "rpm", ...
2008-11-09 00:48:36 +00:00
primary key (build, path),
2008-11-11 12:54:37 +00:00
foreign key (build) references Builds(id) on delete cascade -- ignored by sqlite
);
2008-11-11 12:54:37 +00:00
create table BuildLogs (
2008-11-09 00:48:36 +00:00
build integer not null,
logPhase text not null,
path text not null,
type text not null,
2008-11-09 00:48:36 +00:00
primary key (build, logPhase),
2008-11-11 12:54:37 +00:00
foreign key (build) 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
2008-11-11 12:54:37 +00:00
delete from BuildSchedulingInfo where id = old.id;
delete from BuildResultInfo where id = old.id;
delete from BuildInputs where build = old.id;
delete from BuildLogs where build = old.id;
delete from BuildProducts where build = old.id;
end;
2008-11-04 18:23:28 +00:00
2008-11-11 12:54:37 +00:00
create table Projects (
2008-11-04 18:23:28 +00:00
name text primary key not null
);
-- A jobset consists of a set of inputs (e.g. SVN repositories), one
-- of which contains a Nix expression containing an attribute set
-- describing build jobs.
2008-11-11 12:54:37 +00:00
create table Jobsets (
2008-11-04 18:23:28 +00:00
name text not null,
project text not null,
description text,
2008-11-10 10:18:50 +00:00
nixExprInput text not null, -- name of the jobsetInput containing the Nix expression
2008-11-04 18:23:28 +00:00
nixExprPath text not null, -- relative path of the Nix expression
primary key (project, name),
2008-11-11 12:54:37 +00:00
foreign key (project) references Projects(name) on delete cascade, -- ignored by sqlite
foreign key (project, name, nixExprInput) references JobsetInputs(project, job, name)
2008-11-04 18:23:28 +00:00
);
2008-11-11 12:54:37 +00:00
create table JobsetInputs (
2008-11-04 18:23:28 +00:00
project text not null,
2008-11-06 18:26:29 +00:00
jobset text not null,
2008-11-04 18:23:28 +00:00
name text not null,
2008-11-06 18:26:29 +00:00
type text not null, -- "svn", "cvs", "path", "file", "string"
primary key (project, jobset, name),
2008-11-11 12:54:37 +00:00
foreign key (project, jobset) references Jobsets(project, name) on delete cascade -- ignored by sqlite
2008-11-06 18:26:29 +00:00
);
2008-11-11 12:54:37 +00:00
create table JobsetInputAlts (
2008-11-06 18:26:29 +00:00
project text not null,
jobset text not null,
input text not null,
altnr integer,
-- urgh
2008-11-04 18:23:28 +00:00
uri text,
2008-11-06 18:26:29 +00:00
revision integer, -- for type == 'svn'
tag text, -- for type == 'cvs'
value text, -- for type == 'string'
primary key (project, jobset, input, altnr),
2008-11-11 12:54:37 +00:00
foreign key (project, jobset, input) references JobsetInputs(project, jobset, name) on delete cascade -- ignored by sqlite
);