← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/db-pocket-chroot-image-type into lp:launchpad/db-devel

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/db-pocket-chroot-image-type into lp:launchpad/db-devel.

Commit message:
Add PocketChroot.image_type column.

Requested reviews:
  Stuart Bishop (stub): db
  Launchpad code reviewers (launchpad-reviewers): db
Related bugs:
  Bug #1811677 in Launchpad itself: "Allow dispatching livefs and snap builds based on LXD images"
  https://bugs.launchpad.net/launchpad/+bug/1811677

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/db-pocket-chroot-image-type/+merge/361733

There are only 168 rows in PocketChroot on production, so I don't think it's worth populating the new column separately; we can just do it in DDL.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/db-pocket-chroot-image-type into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-86-0.sql'
--- database/schema/patch-2209-86-0.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-86-0.sql	2019-01-14 13:40:57 +0000
@@ -0,0 +1,15 @@
+-- Copyright 2019 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+-- 0 == CHROOT
+ALTER TABLE PocketChroot
+    ADD COLUMN image_type integer DEFAULT 0 NOT NULL,
+    ADD CONSTRAINT pocketchroot__distroarchseries__pocket__image_type__key
+        UNIQUE (distroarchseries, pocket, image_type),
+    DROP CONSTRAINT pocketchroot_distroarchrelease_key;
+
+COMMENT ON COLUMN PocketChroot.image_type IS 'The type of this image.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 86, 0);