← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/db-snap-build-build-request into lp:launchpad/db-devel

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/db-snap-build-build-request into lp:launchpad/db-devel.

Commit message:
Add SnapBuild.build_request column.

Requested reviews:
  Stuart Bishop (stub): db
  Launchpad code reviewers (launchpad-reviewers): db
Related bugs:
  Bug #1770400 in Launchpad itself: "Support snapcraft architectures keyword"
  https://bugs.launchpad.net/launchpad/+bug/1770400

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/db-snap-build-build-request/+merge/352303

This will support including a link to the build request in snap:build:0.1 webhook payloads, which I need as part of converting build.snapcraft.io over to the new snap.requestBuilds interface (because it needs to be able to issue a build request, keep a note of the reason it did so, and then retrieve that when it receives a webhook delivery indicating that the build has been created).

This is a bit denormalised, because the reverse link is already in SnapJob.json_data.  However, that's awkward to get at efficiently given a build, and since it's immutable for any given build I don't think denormalisation is a problem.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/db-snap-build-build-request into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-83-4.sql'
--- database/schema/patch-2209-83-4.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-83-4.sql	2018-08-03 13:50:20 +0000
@@ -0,0 +1,10 @@
+-- Copyright 2018 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+ALTER TABLE SnapBuild ADD COLUMN build_request integer REFERENCES job;
+
+COMMENT ON COLUMN SnapBuild.build_request IS 'The build request that caused this build to be created.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 83, 4);