← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Add Webhook.snap column.

Requested reviews:
  Stuart Bishop (stub): db
  Launchpad code reviewers (launchpad-reviewers): db
Related bugs:
  Bug #1535826 in Launchpad itself: "Add webhook support for snaps"
  https://bugs.launchpad.net/launchpad/+bug/1535826

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/db-snap-webhooks/+merge/283192

Add Webhook.snap column.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/db-snap-webhooks into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-69-2.sql'
--- database/schema/patch-2209-69-2.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-69-2.sql	2016-01-19 17:41:57 +0000
@@ -0,0 +1,14 @@
+-- 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 Webhook ADD COLUMN snap integer REFERENCES Snap;
+
+ALTER TABLE Webhook DROP CONSTRAINT one_target;
+ALTER TABLE Webhook ADD CONSTRAINT one_target CHECK (null_count(ARRAY[git_repository, branch, snap]) = 2);
+
+CREATE INDEX webhook__snap__id__idx
+    ON webhook(snap, id) WHERE snap IS NOT NULL;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 69, 2);