← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ilasc/launchpad:db-webhook-livefs into launchpad:db-devel

 

Ioana Lasc has proposed merging ~ilasc/launchpad:db-webhook-livefs into launchpad:db-devel.

Commit message:
Add livefs to Webhook table

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Added livefs column to the Webhook table and created index on it (webhook__livefs__id__idx).
This patch is needed to enable webhooks for LiveFS builds.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:db-webhook-livefs into launchpad:db-devel.
diff --git a/database/schema/patch-2210-10-0.sql b/database/schema/patch-2210-10-0.sql
new file mode 100644
index 0000000..8ea0a85
--- /dev/null
+++ b/database/schema/patch-2210-10-0.sql
@@ -0,0 +1,14 @@
+-- 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;
+
+ALTER TABLE Webhook ADD COLUMN livefs integer REFERENCES livefs;
+
+ALTER TABLE Webhook DROP CONSTRAINT one_target;
+ALTER TABLE Webhook ADD CONSTRAINT one_target CHECK (null_count(ARRAY[git_repository, branch, snap, livefs]) = 3);
+
+CREATE INDEX webhook__livefs__id__idx
+    ON webhook(livefs, id) WHERE livefs IS NOT NULL;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 10, 0);