Merge lp:~cjwatson/launchpad/db-snap-upload-to-store into lp:launchpad/db-devel

Proposed by Colin Watson
Status: Merged
Merged at revision: 13419
Proposed branch: lp:~cjwatson/launchpad/db-snap-upload-to-store
Merge into: lp:launchpad/db-devel
Diff against target: 90 lines (+74/-0)
2 files modified
database/schema/patch-2209-69-3.sql (+71/-0)
database/schema/security.cfg (+3/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/db-snap-upload-to-store
Reviewer Review Type Date Requested Status
William Grant db Approve
Review via email: mp+292391@code.launchpad.net

Commit message

Add SnappySeries, SnappyDistroSeries, and SnapBuildJob tables; add Snap columns needed for automatic store uploading.

Description of the change

Add SnappySeries, SnappyDistroSeries, and SnapBuildJob tables; add Snap columns needed for automatic store uploading.

To post a comment you must log in.
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-69-3.sql'
2--- database/schema/patch-2209-69-3.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-69-3.sql 2016-05-06 11:50:31 +0000
4@@ -0,0 +1,71 @@
5+-- Copyright 2016 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 SnappySeries (
11+ id serial PRIMARY KEY,
12+ date_created timestamp without time zone DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
13+ registrant integer NOT NULL REFERENCES person,
14+ name text NOT NULL,
15+ display_name text NOT NULL,
16+ status integer NOT NULL
17+);
18+
19+CREATE UNIQUE INDEX snappyseries__name__key ON SnappySeries(name);
20+CREATE INDEX snappyseries__registrant__idx ON SnappySeries(registrant);
21+CREATE INDEX snappyseries__status__idx ON SnappySeries(status);
22+
23+COMMENT ON TABLE SnappySeries IS 'A series for snap packages in the store.';
24+COMMENT ON COLUMN SnappySeries.date_created IS 'The date on which this series was created in Launchpad.';
25+COMMENT ON COLUMN SnappySeries.registrant IS 'The user who registered this series.';
26+COMMENT ON COLUMN SnappySeries.name IS 'The unique name of this series.';
27+COMMENT ON COLUMN SnappySeries.display_name IS 'The display name of this series.';
28+COMMENT ON COLUMN SnappySeries.status IS 'The current status of this series.';
29+
30+CREATE TABLE SnappyDistroSeries (
31+ snappy_series integer NOT NULL REFERENCES snappyseries,
32+ distro_series integer NOT NULL REFERENCES distroseries,
33+ PRIMARY KEY (snappy_series, distro_series)
34+);
35+
36+CREATE INDEX snappydistroseries__distro_series__idx ON SnappyDistroSeries(distro_series);
37+
38+COMMENT ON TABLE SnappyDistroSeries IS 'A record indicating that a particular snappy series is valid for builds from a particular distribution series.';
39+COMMENT ON COLUMN SnappyDistroSeries.snappy_series IS 'The snappy series which is valid for builds from this distribution series.';
40+COMMENT ON COLUMN SnappyDistroSeries.distro_series IS 'The distribution series whose builds are valid for this snappy series.';
41+
42+ALTER TABLE Snap
43+ ADD COLUMN store_upload boolean DEFAULT false NOT NULL,
44+ ADD COLUMN store_series integer REFERENCES snappyseries,
45+ ADD COLUMN store_name text,
46+ ADD COLUMN store_secrets text,
47+ ADD CONSTRAINT consistent_store_upload CHECK (
48+ NOT store_upload
49+ OR (store_series IS NOT NULL AND store_name IS NOT NULL));
50+
51+COMMENT ON COLUMN Snap.store_upload IS 'Whether builds of this snap package are automatically uploaded to the store.';
52+COMMENT ON COLUMN Snap.store_series IS 'The series in which this snap package should be published in the store.';
53+COMMENT ON COLUMN Snap.store_name IS 'The registered name of this snap package in the store.';
54+COMMENT ON COLUMN Snap.store_secrets IS 'Serialized secrets issued by the store and the login service to authorize uploads of this snap package.';
55+
56+CREATE INDEX snap__store_series__idx
57+ ON Snap(store_series) WHERE store_series IS NOT NULL;
58+
59+CREATE TABLE SnapBuildJob (
60+ job integer PRIMARY KEY REFERENCES Job ON DELETE CASCADE NOT NULL,
61+ snapbuild integer REFERENCES SnapBuild NOT NULL,
62+ job_type integer NOT NULL,
63+ json_data text NOT NULL
64+);
65+
66+CREATE INDEX snapbuildjob__snapbuild__job_type__job__idx
67+ ON SnapBuildJob(snapbuild, job_type, job);
68+
69+COMMENT ON TABLE SnapBuildJob IS 'Contains references to jobs that are executed for a build of a snap package.';
70+COMMENT ON COLUMN SnapBuildJob.job IS 'A reference to a Job row that has all the common job details.';
71+COMMENT ON COLUMN SnapBuildJob.snapbuild IS 'The snap build that this job is for.';
72+COMMENT ON COLUMN SnapBuildJob.job_type IS 'The type of a job, such as a store upload.';
73+COMMENT ON COLUMN SnapBuildJob.json_data IS 'Data that is specific to a particular job type.';
74+
75+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 69, 3);
76
77=== modified file 'database/schema/security.cfg'
78--- database/schema/security.cfg 2016-04-16 12:21:40 +0000
79+++ database/schema/security.cfg 2016-05-06 11:50:31 +0000
80@@ -291,7 +291,10 @@
81 public.snap = SELECT, INSERT, UPDATE, DELETE
82 public.snaparch = SELECT, INSERT, DELETE
83 public.snapbuild = SELECT, INSERT, UPDATE, DELETE
84+public.snapbuildjob = SELECT, INSERT, UPDATE, DELETE
85 public.snapfile = SELECT, INSERT, UPDATE, DELETE
86+public.snappydistroseries = SELECT, INSERT, DELETE
87+public.snappyseries = SELECT, INSERT, UPDATE, DELETE
88 public.sourcepackageformatselection = SELECT
89 public.sourcepackagepublishinghistory = SELECT
90 public.sourcepackagerecipe = SELECT, INSERT, UPDATE, DELETE

Subscribers

People subscribed via source and target branches

to status/vote changes: