launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26758
[Merge] ~cjwatson/launchpad:db-snap-base-dependency into launchpad:db-devel
Colin Watson has proposed merging ~cjwatson/launchpad:db-snap-base-dependency into launchpad:db-devel.
Commit message:
Add ArchiveDependency.snap_base and SnapBuild.snap_base
Requested reviews:
Launchpad code reviewers (launchpad-reviewers): db
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/400347
These new columns support adding archive dependencies to SnapBase, so that all builds for certain snap bases can be configured to use an additional archive.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:db-snap-base-dependency into launchpad:db-devel.
diff --git a/database/schema/patch-2210-30-0.sql b/database/schema/patch-2210-30-0.sql
new file mode 100644
index 0000000..c7190e9
--- /dev/null
+++ b/database/schema/patch-2210-30-0.sql
@@ -0,0 +1,21 @@
+-- Copyright 2021 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 ArchiveDependency
+ ADD COLUMN snap_base integer REFERENCES snapbase,
+ ALTER COLUMN archive DROP NOT NULL,
+ ADD CONSTRAINT one_parent CHECK (null_count(ARRAY[archive, snap_base]) = 1);
+
+CREATE INDEX archivedependency__snap_base__idx
+ ON ArchiveDependency (snap_base);
+
+COMMENT ON TABLE ArchiveDependency IS 'This table maps a given parent (archive or snap base) to all other archives it should depend on.';
+COMMENT ON COLUMN ArchiveDependency.snap_base IS 'The snap base that has this dependency.';
+
+ALTER TABLE SnapBuild ADD COLUMN snap_base integer REFERENCES snapbase;
+
+COMMENT ON COLUMN SnapBuild.snap_base IS 'The snap base to use for this build.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 30, 0);