2016-07-23 17:00:38 +02:00
|
|
|
BEGIN TRANSACTION;
|
|
|
|
|
|
|
|
CREATE TABLE Specifications (
|
2016-11-13 01:54:41 +01:00
|
|
|
repo_name TEXT NOT NULL PRIMARY KEY,
|
2016-07-23 17:00:38 +02:00
|
|
|
url TEXT NOT NULL,
|
|
|
|
load_path TEXT NOT NULL,
|
|
|
|
file TEXT NOT NULL,
|
|
|
|
proc TEXT NOT NULL,
|
|
|
|
arguments TEXT NOT NULL,
|
|
|
|
-- The following columns are optional.
|
|
|
|
branch TEXT,
|
|
|
|
tag TEXT,
|
2016-09-15 23:15:54 +02:00
|
|
|
revision TEXT,
|
|
|
|
no_compile_p INTEGER
|
2016-07-23 17:00:38 +02:00
|
|
|
);
|
|
|
|
|
2016-07-26 00:36:12 +02:00
|
|
|
CREATE TABLE Stamps (
|
2016-11-13 01:54:41 +01:00
|
|
|
specification TEXT NOT NULL PRIMARY KEY,
|
2016-07-26 00:36:12 +02:00
|
|
|
stamp TEXT NOT NULL,
|
2016-11-13 01:54:41 +01:00
|
|
|
FOREIGN KEY (specification) REFERENCES Specifications (repo_name)
|
2016-07-26 00:36:12 +02:00
|
|
|
);
|
|
|
|
|
2016-07-23 17:00:38 +02:00
|
|
|
CREATE TABLE Evaluations (
|
2016-07-26 16:53:57 +02:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
2016-11-13 01:54:41 +01:00
|
|
|
specification TEXT NOT NULL,
|
2016-07-27 19:19:26 +02:00
|
|
|
revision TEXT NOT NULL,
|
2016-11-13 01:54:41 +01:00
|
|
|
FOREIGN KEY (specification) REFERENCES Specifications (repo_name)
|
2016-07-16 18:16:39 +02:00
|
|
|
);
|
|
|
|
|
2016-07-26 16:53:57 +02:00
|
|
|
CREATE TABLE Derivations (
|
|
|
|
derivation TEXT NOT NULL,
|
|
|
|
evaluation INTEGER NOT NULL,
|
|
|
|
job_name TEXT NOT NULL,
|
2017-07-31 19:25:28 +02:00
|
|
|
system TEXT NOT NULL,
|
|
|
|
nix_name TEXT NOT NULL,
|
2016-07-26 16:53:57 +02:00
|
|
|
PRIMARY KEY (derivation, evaluation),
|
|
|
|
FOREIGN KEY (evaluation) REFERENCES Evaluations (id)
|
|
|
|
);
|
|
|
|
|
2017-07-31 19:25:28 +02:00
|
|
|
CREATE TABLE Outputs (
|
|
|
|
build INTEGER NOT NULL,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
path TEXT NOT NULL,
|
|
|
|
PRIMARY KEY (build, name),
|
|
|
|
FOREIGN KEY (build) REFERENCES Builds (id)
|
|
|
|
);
|
|
|
|
|
2016-07-27 13:21:11 +02:00
|
|
|
-- Builds are not in a one to one relationship with derivations in order to
|
|
|
|
-- keep track of non deterministic compilations.
|
2016-07-23 17:00:38 +02:00
|
|
|
CREATE TABLE Builds (
|
2017-07-31 19:25:28 +02:00
|
|
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
2016-07-27 13:21:11 +02:00
|
|
|
derivation TEXT NOT NULL,
|
|
|
|
evaluation INTEGER NOT NULL,
|
|
|
|
log TEXT NOT NULL,
|
2017-07-31 19:25:28 +02:00
|
|
|
status INTEGER NOT NULL,
|
|
|
|
timestamp INTEGER NOT NULL,
|
|
|
|
starttime INTEGER NOT NULL,
|
|
|
|
stoptime INTEGER NOT NULL,
|
2016-07-27 13:21:11 +02:00
|
|
|
FOREIGN KEY (derivation) REFERENCES Derivations (derivation),
|
|
|
|
FOREIGN KEY (evaluation) REFERENCES Evaluations (id)
|
2016-07-16 18:16:39 +02:00
|
|
|
);
|
2016-07-23 17:00:38 +02:00
|
|
|
|
2018-02-14 18:30:24 +01:00
|
|
|
-- Create indexes to speed up common queries, in particular those
|
|
|
|
-- corresponding to /api/latestbuilds HTTP requests.
|
|
|
|
CREATE INDEX Builds_Derivations_index ON Builds(status ASC, derivation, evaluation, stoptime DESC);
|
|
|
|
CREATE INDEX Specifications_index ON Specifications(repo_name, branch);
|
|
|
|
CREATE INDEX Derivations_index ON Derivations(derivation, evaluation, job_name, system);
|
|
|
|
|
2016-07-23 17:00:38 +02:00
|
|
|
COMMIT;
|