← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:db-charm-base into launchpad:db-devel

 

Colin Watson has proposed merging ~cjwatson/launchpad:db-charm-base into launchpad:db-devel.

Commit message:
Add CharmBase and CharmBaseArch tables

Requested reviews:
  William Grant (wgrant): db
  Launchpad code reviewers (launchpad-reviewers): db

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/409007

The immediate motivation for these is to be able to suppress i386 builds for charm recipes based on 20.04, but the ability to specify different snap channels for charmcraft may come in useful as well.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:db-charm-base into launchpad:db-devel.
diff --git a/database/schema/patch-2210-33-2.sql b/database/schema/patch-2210-33-2.sql
new file mode 100644
index 0000000..ff60ec6
--- /dev/null
+++ b/database/schema/patch-2210-33-2.sql
@@ -0,0 +1,33 @@
+-- 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;
+
+CREATE TABLE CharmBase (
+    id serial PRIMARY KEY,
+    date_created timestamp without time zone DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
+    registrant integer NOT NULL REFERENCES person,
+    distro_series integer NOT NULL REFERENCES distroseries,
+    build_channels text NOT NULL
+);
+
+CREATE INDEX charmbase__registrant__idx ON CharmBase (registrant);
+CREATE UNIQUE INDEX charmbase__distro_series__key ON CharmBase (distro_series);
+
+COMMENT ON TABLE CharmBase IS 'A base for charms.';
+COMMENT ON COLUMN CharmBase.date_created IS 'The date on which this base was created in Launchpad.';
+COMMENT ON COLUMN CharmBase.registrant IS 'The user who registered this base.';
+COMMENT ON COLUMN CharmBase.distro_series IS 'The distro series for this base.';
+COMMENT ON COLUMN CharmBase.build_channels IS 'A dictionary mapping snap names to channels to use when building charm recipes that specify this base.';
+
+CREATE TABLE CharmBaseArch (
+    charm_base integer NOT NULL REFERENCES charmbase,
+    processor integer NOT NULL REFERENCES processor,
+    PRIMARY KEY (charm_base, processor)
+);
+
+COMMENT ON TABLE CharmBaseArch IS 'The architectures that a charm base supports.';
+COMMENT ON COLUMN CharmBaseArch.charm_base IS 'The charm base for which a supported architecture is specified.';
+COMMENT ON COLUMN CharmBaseArch.processor IS 'A supported architecture for this charm base.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 33, 2);