Merge ~cjwatson/launchpad:db-oci-recipe-build-job into launchpad:db-devel

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 36cb1837fbd9da8e6b7ab5144c705bccfcc765ae
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:db-oci-recipe-build-job
Merge into: launchpad:db-devel
Diff against target: 58 lines (+27/-0)
2 files modified
database/schema/patch-2210-08-7.sql (+22/-0)
database/schema/security.cfg (+5/-0)
Reviewer Review Type Date Requested Status
William Grant db Approve
Kristian Glass (community) Approve
Tom Wardill (community) db Approve
Review via email: mp+381058@code.launchpad.net

Commit message

Add OCIRecipeBuildJob table

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve (db)
Revision history for this message
Kristian Glass (doismellburning) :
review: Approve
36cb183... by Colin Watson

Add OCIRecipeBuildJob (job, job_type) index

This will be useful for job deletion in future.

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
1diff --git a/database/schema/patch-2210-08-7.sql b/database/schema/patch-2210-08-7.sql
2new file mode 100644
3index 0000000..47ea635
4--- /dev/null
5+++ b/database/schema/patch-2210-08-7.sql
6@@ -0,0 +1,22 @@
7+-- Copyright 2020 Canonical Ltd. This software is licensed under the
8+-- GNU Affero General Public License version 3 (see the file LICENSE).
9+
10+CREATE TABLE OCIRecipeBuildJob (
11+ job integer PRIMARY KEY REFERENCES Job ON DELETE CASCADE NOT NULL,
12+ build integer REFERENCES ocirecipebuild NOT NULL,
13+ job_type integer NOT NULL,
14+ json_data jsonb NOT NULL
15+);
16+
17+COMMENT ON TABLE OCIRecipeBuildJob IS 'Contains references to jobs that are executed for a build of an OCI recipe.';
18+COMMENT ON COLUMN OCIRecipeBuildJob.job IS 'A reference to a Job row that has all the common job details.';
19+COMMENT ON COLUMN OCIRecipeBuildJob.build IS 'The OCI recipe build that this job is for.';
20+COMMENT ON COLUMN OCIRecipeBuildJob.job_type IS 'The type of a job, such as a registry push.';
21+COMMENT ON COLUMN OCIRecipeBuildJob.json_data IS 'Data that is specific to a particular job type.';
22+
23+CREATE INDEX ocirecipebuildjob__build__job_type__job__idx
24+ ON OCIRecipeBuildJob (build, job_type, job);
25+CREATE INDEX ocirecipebuildjob__job__job_type__idx
26+ ON OCIRecipeBuildJob (job, job_type);
27+
28+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 08, 7);
29diff --git a/database/schema/security.cfg b/database/schema/security.cfg
30index 91b8407..f5cca8d 100644
31--- a/database/schema/security.cfg
32+++ b/database/schema/security.cfg
33@@ -249,6 +249,7 @@ public.ocipushrule = SELECT, INSERT, UPDATE, DELETE
34 public.ocirecipe = SELECT, INSERT, UPDATE, DELETE
35 public.ocirecipearch = SELECT, INSERT, DELETE
36 public.ocirecipebuild = SELECT, INSERT, UPDATE, DELETE
37+public.ocirecipebuildjob = SELECT, INSERT, UPDATE, DELETE
38 public.ociregistrycredentials = SELECT, INSERT, UPDATE, DELETE
39 public.officialbugtag = SELECT, INSERT, UPDATE, DELETE
40 public.openidconsumerassociation = SELECT, INSERT, UPDATE, DELETE
41@@ -1000,6 +1001,7 @@ public.ociproject = SELECT
42 public.ociprojectname = SELECT
43 public.ocirecipe = SELECT
44 public.ocirecipebuild = SELECT, UPDATE
45+public.ocirecipebuildjob = SELECT, INSERT
46 public.openididentifier = SELECT
47 public.packageset = SELECT
48 public.packagesetgroup = SELECT
49@@ -1433,6 +1435,9 @@ public.milestonetag = SELECT
50 public.ociproject = SELECT
51 public.ociprojectname = SELECT
52 public.ociprojectseries = SELECT
53+public.ocirecipe = SELECT, UPDATE
54+public.ocirecipebuild = SELECT, UPDATE
55+public.ocirecipebuildjob = SELECT, INSERT, UPDATE
56 public.openididentifier = SELECT
57 public.packagecopyjob = SELECT, INSERT
58 public.packagediff = SELECT, INSERT, UPDATE, DELETE

Subscribers

People subscribed via source and target branches

to status/vote changes: