aboutsummaryrefslogtreecommitdiff
path: root/src/sql/upgrade-7.sql
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2020-06-10 15:58:11 +0200
committerMathieu Othacehe <m.othacehe@gmail.com>2020-06-10 16:42:21 +0200
commitf44618fc79a730944cd3165a390d896777a8dad0 (patch)
treed91e33ca38f80574589f6f895ef0855c42be0812 /src/sql/upgrade-7.sql
parent78986d962352f3d5e092c441d5f6e0b1200de957 (diff)
downloadcuirass-f44618fc79a730944cd3165a390d896777a8dad0.tar
cuirass-f44618fc79a730944cd3165a390d896777a8dad0.tar.gz
Add support for build products downloading.
* src/sql/upgrade-7.sql: New file. * Makefile.am: Add it. * src/cuirass/base.scm (create-build-outputs): New procedure, (build-packages): call it, (process-spec): add the new spec argument and pass it to create-build-outputs. * src/cuirass/database.scm (db-add-build-product, db-get-build-product-path, db-get-build-products): New exported procedures. * src/cuirass/http.scm (respond-static-file): Move file sending to ... (respond-file): ... this new procedure, (url-handler): add a new "download/<id>" route, serving the requested file with the new respond-file procedure. Also gather build products and pass them to "build-details" for "build/<id>/details" route. * src/cuirass/templates.scm (build-details): Honor the new "products" argument to display all the build products associated to the given build. * src/schema.sql (BuildProducts): New table, (Specifications)[build_outputs]: new field. * tests/database.scm: Add empty build-outputs spec. * tests/http.scm: Ditto. * examples/guix-jobs.scm: Ditto. * examples/hello-git.scm: Ditto. * examples/hello-singleton.scm: Ditto. * examples/hello-subset.scm: Ditto. * examples/random.scm: Ditto. * doc/cuirass.texi (overview): Document it.
Diffstat (limited to 'src/sql/upgrade-7.sql')
-rw-r--r--src/sql/upgrade-7.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sql/upgrade-7.sql b/src/sql/upgrade-7.sql
new file mode 100644
index 0000000..b9bd4ff
--- /dev/null
+++ b/src/sql/upgrade-7.sql
@@ -0,0 +1,15 @@
+BEGIN TRANSACTION;
+
+CREATE TABLE BuildProducts (
+ build INTEGER NOT NULL,
+ type TEXT NOT NULL,
+ file_size BIGINT NOT NULL,
+ checksum TEXT NOT NULL,
+ path TEXT NOT NULL,
+ PRIMARY KEY (build, path)
+ FOREIGN KEY (build) REFERENCES Builds (id) ON DELETE CASCADE
+);
+
+ALTER TABLE Specifications ADD build_outputs TEXT NOT NULL DEFAULT "()";
+
+COMMIT;