Merge ~pappacena/launchpad:db-patch-async-request-oci-recipe-build into launchpad:db-devel

Proposed by Thiago F. Pappacena
Status: Merged
Approved by: Thiago F. Pappacena
Approved revision: 6c80c13d278240b8909a138de09e408aac958896
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~pappacena/launchpad:db-patch-async-request-oci-recipe-build
Merge into: launchpad:db-devel
Diff against target: 40 lines (+23/-0)
2 files modified
database/schema/patch-2210-15-0.sql (+22/-0)
database/schema/security.cfg (+1/-0)
Reviewer Review Type Date Requested Status
William Grant db Approve
Colin Watson (community) db Approve
Review via email: mp+382318@code.launchpad.net

This proposal supersedes a proposal from 2020-04-14.

Commit message

Database patch adding OCIRecipeJob table.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote : Posted in a previous version of this proposal

This is targeted at the wrong branch. Could you resubmit it with the target branch set to db-devel, please?

review: Needs Resubmitting
4e9689b... by Thiago F. Pappacena

Adjusting OCIRecipeJob details and adding comments to it

Revision history for this message
Colin Watson (cjwatson) wrote :

LGTM now, but I've added William for a second DB review.

review: Approve (db)
Revision history for this message
William Grant (wgrant) wrote :

Looks great, thanks.

review: Approve (db)
6c80c13... by Thiago F. Pappacena

Sorting security.cfg tables

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-15-0.sql b/database/schema/patch-2210-15-0.sql
2new file mode 100644
3index 0000000..9fd355b
4--- /dev/null
5+++ b/database/schema/patch-2210-15-0.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+SET client_min_messages=ERROR;
11+
12+CREATE TABLE OCIRecipeJob (
13+ job integer PRIMARY KEY REFERENCES Job ON DELETE CASCADE NOT NULL,
14+ recipe INTEGER NOT NULL REFERENCES OCIRecipe,
15+ job_type INTEGER NOT NULL,
16+ json_data jsonb NOT NULL
17+);
18+
19+CREATE INDEX ocirecipejob__recipe__job_type__job__idx
20+ ON OCIRecipeJob(recipe, job_type, job);
21+
22+COMMENT ON TABLE OCIRecipeJob IS 'Contains references to jobs that are executed for an OCI Recipe.';
23+COMMENT ON COLUMN OCIRecipeJob.job IS 'A reference to a Job row that has all the common job details.';
24+COMMENT ON COLUMN OCIRecipeJob.recipe IS 'The OCI recipe that this job is for.';
25+COMMENT ON COLUMN OCIRecipeJob.job_type IS 'The type of a job, such as a build request.';
26+COMMENT ON COLUMN OCIRecipeJob.json_data IS 'Data that is specific to a particular job type.';
27+
28+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 15, 0);
29diff --git a/database/schema/security.cfg b/database/schema/security.cfg
30index 55226e1..d36a542 100644
31--- a/database/schema/security.cfg
32+++ b/database/schema/security.cfg
33@@ -250,6 +250,7 @@ public.ocirecipe = SELECT, INSERT, UPDATE, DELETE
34 public.ocirecipearch = SELECT, INSERT, DELETE
35 public.ocirecipebuild = SELECT, INSERT, UPDATE, DELETE
36 public.ocirecipebuildjob = SELECT, INSERT, UPDATE, DELETE
37+public.ocirecipejob = 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