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

Proposed by Colin Watson
Status: Merged
Merged at revision: 13924
Proposed branch: lp:~cjwatson/launchpad/db-snap-build-build-request
Merge into: lp:launchpad/db-devel
Diff against target: 14 lines (+10/-0)
1 file modified
database/schema/patch-2209-83-4.sql (+10/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/db-snap-build-build-request
Reviewer Review Type Date Requested Status
William Grant db Approve
Stuart Bishop db Pending
Review via email: mp+352303@code.launchpad.net

Commit message

Add SnapBuild.build_request column.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

This will prevent us from pruning those jobs, but we already don't do that.

review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-83-4.sql'
2--- database/schema/patch-2209-83-4.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-83-4.sql 2018-08-03 13:50:20 +0000
4@@ -0,0 +1,10 @@
5+-- Copyright 2018 Canonical Ltd. This software is licensed under the
6+-- GNU Affero General Public License version 3 (see the file LICENSE).
7+
8+SET client_min_messages=ERROR;
9+
10+ALTER TABLE SnapBuild ADD COLUMN build_request integer REFERENCES job;
11+
12+COMMENT ON COLUMN SnapBuild.build_request IS 'The build request that caused this build to be created.';
13+
14+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 83, 4);

Subscribers

People subscribed via source and target branches

to status/vote changes: