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

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

Commit message

Add SnapJob table.

Description of the change

We have SnapBuildJob already, but Snap.requestBuilds is going to need an asynchronous job that's associated with a Snap but not with any particular SnapBuild.

Long-term we perhaps ought to consolidate these two tables into SnapJob (and I should have done it that way to start with), but there's no particular urgency.

The corresponding code MP is https://code.launchpad.net/~cjwatson/launchpad/snap-request-builds-job/+merge/348058.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
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-3.sql'
2--- database/schema/patch-2209-83-3.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-83-3.sql 2018-06-15 12:59:59 +0000
4@@ -0,0 +1,22 @@
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+CREATE TABLE SnapJob (
11+ job integer PRIMARY KEY REFERENCES Job ON DELETE CASCADE NOT NULL,
12+ snap integer REFERENCES Snap NOT NULL,
13+ job_type integer NOT NULL,
14+ json_data text NOT NULL
15+);
16+
17+CREATE INDEX snapjob__snap__job_type__job__idx
18+ ON SnapJob(snap, job_type, job);
19+
20+COMMENT ON TABLE SnapJob IS 'Contains references to jobs that are executed for a snap package.';
21+COMMENT ON COLUMN SnapJob.job IS 'A reference to a Job row that has all the common job details.';
22+COMMENT ON COLUMN SnapJob.snap IS 'The snap package that this job is for.';
23+COMMENT ON COLUMN SnapJob.job_type IS 'The type of a job, such as a build request.';
24+COMMENT ON COLUMN SnapJob.json_data IS 'Data that is specific to a particular job type.';
25+
26+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 83, 3);

Subscribers

People subscribed via source and target branches

to status/vote changes: