← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/db-snap-auto-build into lp:launchpad/db-devel

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/db-snap-auto-build into lp:launchpad/db-devel.

Commit message:
Add columns to support auto-building of snap packages.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1593359 in Launchpad itself: "Add option to trigger snap builds when top-level branch changes"
  https://bugs.launchpad.net/launchpad/+bug/1593359

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/db-snap-auto-build/+merge/297667

Add columns to support auto-building of snap packages.  These correspond to the information we need to have to call Snap.requestBuild.

There are few enough Snap rows on production right now that I think it's fine to just populate the new columns and make them NOT NULL straight away.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/db-snap-auto-build into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-69-4.sql'
--- database/schema/patch-2209-69-4.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-69-4.sql	2016-06-16 18:15:32 +0000
@@ -0,0 +1,18 @@
+-- Copyright 2016 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 Snap
+    ADD COLUMN auto_build boolean DEFAULT false NOT NULL,
+    ADD COLUMN auto_build_archive integer REFERENCES archive,
+    ADD COLUMN auto_build_pocket integer,
+    ADD COLUMN is_stale boolean DEFAULT true NOT NULL,
+    ADD CONSTRAINT consistent_auto_build CHECK (NOT auto_build OR (auto_build_archive IS NOT NULL AND auto_build_pocket IS NOT NULL));
+
+COMMENT ON COLUMN Snap.auto_build IS 'Whether this snap is built automatically when the branch containing its snap recipe changes.';
+COMMENT ON COLUMN Snap.auto_build_archive IS 'The archive that automatic builds of this snap package should build from.';
+COMMENT ON COLUMN Snap.auto_build_pocket IS 'The pocket that automatic builds of this snap package should build from.';
+COMMENT ON COLUMN Snap.is_stale IS 'True if this snap package has not been built since a branch was updated.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 69, 4);