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

Proposed by Ioana Lasc
Status: Merged
Approved by: Colin Watson
Approved revision: 4e1642cad055e9ab453f634ae99df92431232ae5
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~ilasc/launchpad:db-webhook-livefs
Merge into: launchpad:db-devel
Diff against target: 20 lines (+14/-0)
1 file modified
database/schema/patch-2210-10-0.sql (+14/-0)
Reviewer Review Type Date Requested Status
Colin Watson (community) db Approve
Review via email: mp+377874@code.launchpad.net

Commit message

Add livefs to Webhook table

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

With a larger table we might want to create the new index separately, but the webhook table has fewer than 10000 rows so this is unlikely to be a problem in practice.

review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-10-0.sql b/database/schema/patch-2210-10-0.sql
2new file mode 100644
3index 0000000..8ea0a85
4--- /dev/null
5+++ b/database/schema/patch-2210-10-0.sql
6@@ -0,0 +1,14 @@
7+-- Copyright 2019 Canonical Ltd. This software is licensed under the
8+-- GNU Affero General Public License version 3 (see the file LICENSE).
9+
10+SET client_min_messages=ERROR;
11+
12+ALTER TABLE Webhook ADD COLUMN livefs integer REFERENCES livefs;
13+
14+ALTER TABLE Webhook DROP CONSTRAINT one_target;
15+ALTER TABLE Webhook ADD CONSTRAINT one_target CHECK (null_count(ARRAY[git_repository, branch, snap, livefs]) = 3);
16+
17+CREATE INDEX webhook__livefs__id__idx
18+ ON webhook(livefs, id) WHERE livefs IS NOT NULL;
19+
20+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 10, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: