2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/guix-cuirass.git synced 2023-12-14 06:03:04 +01:00
guix-cuirass/src/sql/upgrade-2.sql
Mathieu Othacehe bba1311478
Add jobs support.
Each evaluation registration produces a list of new jobs. Until now, only the
jobs which build outputs were not stored in the "Outputs" table were added to
the "Builds" table.

It means that Cuirass looses track of the job list associated to a given
evaluation.  This is problematic to provide the overall build status of an
evaluation or to find the evaluation providing the best build coverage.

Add a new "Jobs" table that stores the job list of each evaluation.  Also add
a new "/api/jobs" API to consult it.

* src/sql/upgrade-2.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/schema.sql (Jobs): New table.
* src/cuirass/database.scm (db-add-job, db-get-jobs): New procedures.
(db-register-builds): Call db-add-job.
* src/cuirass/http.scm (url-handler): New "/api/jobs" route.
* tests/database.scm ("db-get-jobs", "db-get-jobs names"): New tests.
* doc/cuirass.texi (Web API, Database): Document it.
2021-04-06 15:18:55 +02:00

14 lines
331 B
SQL

BEGIN TRANSACTION;
CREATE TABLE Jobs (
name TEXT NOT NULL,
evaluation INTEGER NOT NULL,
derivation TEXT NOT NULL,
system TEXT NOT NULL,
PRIMARY KEY (evaluation, derivation),
FOREIGN KEY (evaluation) REFERENCES Evaluations(id) ON DELETE CASCADE
);
CREATE INDEX Jobs_name ON Jobs (name);
COMMIT;