← 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 9db3b2669f (Add SnapBaseArch table)

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1862258 in Launchpad itself: "base: core20 snap builds are dispatched for i386, which always fails"
  https://bugs.launchpad.net/launchpad/+bug/1862258

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/403045
-- 
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-30-1.sql b/database/schema/patch-2210-30-1.sql
new file mode 100644
index 0000000..ea50782
--- /dev/null
+++ b/database/schema/patch-2210-30-1.sql
@@ -0,0 +1,23 @@
+-- Copyright 2021 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+CREATE TABLE SnapBaseArch (
+    snap_base integer NOT NULL REFERENCES snapbase,
+    processor integer NOT NULL REFERENCES processor,
+    PRIMARY KEY (snap_base, processor)
+);
+
+COMMENT ON TABLE SnapBaseArch IS 'The architectures that a snap base supports.';
+COMMENT ON COLUMN SnapBaseArch.snap_base IS 'The snap base for which a supported architecture is specified.';
+COMMENT ON COLUMN SnapBaseArch.processor IS 'A supported architecture for this snap base.';
+
+-- Initialize with all possibilities for each corresponding distroseries,
+-- preserving previous behaviour.
+INSERT INTO SnapBaseArch (snap_base, processor)
+    SELECT SnapBase.id, DistroArchSeries.processor
+    FROM SnapBase, DistroArchSeries
+    WHERE
+        SnapBase.distro_series = DistroArchSeries.distroseries
+        AND DistroArchSeries.enabled;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 30, 1);