← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:merge-db-stable into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:merge-db-stable into launchpad:master.

Commit message:
Merge db-stable d3d9c0c064 (Add ArchiveFile.date_created and ArchiveFile.date_superseded; add SigningKey and ArchiveSigningKey)

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1765933 in Launchpad itself: "Allow building livefses against a view of the archive at a fixed point in time"
  https://bugs.launchpad.net/launchpad/+bug/1765933

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/382056
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:merge-db-stable into launchpad:master.
diff --git a/database/schema/patch-2210-09-0.sql b/database/schema/patch-2210-09-0.sql
new file mode 100644
index 0000000..b4c3153
--- /dev/null
+++ b/database/schema/patch-2210-09-0.sql
@@ -0,0 +1,13 @@
+-- Copyright 2018 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+ALTER TABLE ArchiveFile
+    ADD COLUMN date_created timestamp without time zone,
+    ADD COLUMN date_superseded timestamp without time zone;
+
+COMMENT ON COLUMN ArchiveFile.date_created IS 'The date when this file was created.';
+COMMENT ON COLUMN ArchiveFile.date_superseded IS 'The date when this file ceased to hold its path in the archive, due to being removed or superseded by a newer version.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 09, 0);
diff --git a/database/schema/patch-2210-12-0.sql b/database/schema/patch-2210-12-0.sql
new file mode 100644
index 0000000..f459287
--- /dev/null
+++ b/database/schema/patch-2210-12-0.sql
@@ -0,0 +1,45 @@
+-- Copyright 2020 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+
+CREATE TABLE signingkey (
+    id serial PRIMARY KEY,
+    key_type integer NOT NULL,
+    description text,
+    fingerprint text NOT NULL,
+    public_key bytea NOT NULL,
+    date_created timestamp without time zone NOT NULL
+        DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
+
+    -- This unique constraint is needed because ArchiveSigningKey has a
+    -- compound foreign key using both columns.
+    CONSTRAINT signingkey__id__key_type__key
+        UNIQUE(id, key_type),
+
+    CONSTRAINT signingkey__key_type__fingerprint__key
+        UNIQUE (key_type, fingerprint)
+);
+
+
+CREATE TABLE archivesigningkey (
+    id serial PRIMARY KEY,
+    archive integer NOT NULL REFERENCES archive,
+    earliest_distro_series integer REFERENCES distroseries,
+    key_type integer NOT NULL,
+    signing_key integer NOT NULL,
+    date_created timestamp without time zone NOT NULL
+        DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
+
+    CONSTRAINT archivesigningkey__signing_key__fk
+        FOREIGN KEY (signing_key, key_type)
+        REFERENCES signingkey (id, key_type),
+
+    CONSTRAINT archivesigningkey__archive__key_type__earliest_distro_series__key
+        UNIQUE(archive, key_type, earliest_distro_series)
+);
+
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 12, 0);
+
diff --git a/database/schema/security.cfg b/database/schema/security.cfg
index d3ee546..942c5b4 100644
--- a/database/schema/security.cfg
+++ b/database/schema/security.cfg
@@ -1205,6 +1205,7 @@ public.account                          = SELECT, INSERT, UPDATE
 public.archive                          = SELECT, INSERT, UPDATE
 public.archivearch                      = SELECT, INSERT, UPDATE, DELETE
 public.archivejob                       = SELECT, INSERT
+public.archivesigningkey                = SELECT, INSERT, UPDATE
 public.binarypackagebuild               = SELECT, INSERT, UPDATE
 public.binarypackagefile                = SELECT, INSERT, UPDATE
 public.binarypackagename                = SELECT, INSERT, UPDATE
@@ -1282,6 +1283,7 @@ public.project                          = SELECT, INSERT, UPDATE
 public.section                          = SELECT, INSERT, UPDATE
 public.sectionselection                 = SELECT, INSERT, UPDATE
 public.signedcodeofconduct              = SELECT, INSERT, UPDATE
+public.signingkey                       = SELECT, INSERT, UPDATE
 public.sourcepackageformatselection     = SELECT, INSERT
 public.sourcepackagename                = SELECT, INSERT, UPDATE
 public.sourcepackagepublishinghistory   = SELECT, INSERT, UPDATE
@@ -1375,6 +1377,7 @@ public.archivearch                      = SELECT, INSERT, UPDATE
 public.archivefile                      = SELECT
 public.archivejob                       = SELECT, INSERT
 public.archivepermission                = SELECT
+public.archivesigningkey                = SELECT, INSERT
 public.binarypackagebuild               = SELECT, INSERT, UPDATE
 public.binarypackagefile                = SELECT, INSERT
 public.binarypackagename                = SELECT, INSERT
@@ -1473,6 +1476,7 @@ public.snapbuild                        = SELECT, UPDATE
 public.snapbuildjob                     = SELECT, INSERT, UPDATE
 public.snapfile                         = SELECT, INSERT, UPDATE
 public.snappyseries                     = SELECT
+public.signingkey                       = SELECT, INSERT
 public.sourcepackageformatselection     = SELECT
 public.sourcepackagename                = SELECT, INSERT
 public.sourcepackagepublishinghistory   = SELECT, INSERT