Merge ~cjwatson/launchpad:db-snap-base-arch into launchpad:db-devel

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 03626c364ee6104273b43390aaf6ebb7f6417e94
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:db-snap-base-arch
Merge into: launchpad:db-devel
Diff against target: 29 lines (+23/-0)
1 file modified
database/schema/patch-2210-30-1.sql (+23/-0)
Reviewer Review Type Date Requested Status
William Grant db Approve
Cristian Gonzalez Approve
Review via email:

Commit message

Add SnapBaseArch table

Description of the change

A snap base may not support all the architectures supported by its underlying distroseries: in particular, core20 does not support i386. Extend the model to allow us to support this cleanly.

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good! (and also helped me understand the connection between snap bases and distribution series)

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-30-1.sql b/database/schema/patch-2210-30-1.sql
2new file mode 100644
3index 0000000..ea50782
4--- /dev/null
5+++ b/database/schema/patch-2210-30-1.sql
6@@ -0,0 +1,23 @@
7+-- Copyright 2021 Canonical Ltd. This software is licensed under the
8+-- GNU Affero General Public License version 3 (see the file LICENSE).
10+CREATE TABLE SnapBaseArch (
11+ snap_base integer NOT NULL REFERENCES snapbase,
12+ processor integer NOT NULL REFERENCES processor,
13+ PRIMARY KEY (snap_base, processor)
16+COMMENT ON TABLE SnapBaseArch IS 'The architectures that a snap base supports.';
17+COMMENT ON COLUMN SnapBaseArch.snap_base IS 'The snap base for which a supported architecture is specified.';
18+COMMENT ON COLUMN SnapBaseArch.processor IS 'A supported architecture for this snap base.';
20+-- Initialize with all possibilities for each corresponding distroseries,
21+-- preserving previous behaviour.
22+INSERT INTO SnapBaseArch (snap_base, processor)
23+ SELECT, DistroArchSeries.processor
24+ FROM SnapBase, DistroArchSeries
26+ SnapBase.distro_series = DistroArchSeries.distroseries
27+ AND DistroArchSeries.enabled;
29+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 30, 1);


People subscribed via source and target branches

to status/vote changes: