launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29982
[Merge] ~ines-almeida/launchpad:add-new-target-columns-to-webhooks-table into launchpad:db-devel
Ines Almeida has proposed merging ~ines-almeida/launchpad:add-new-target-columns-to-webhooks-table into launchpad:db-devel.
Commit message:
Add db patch with new columns in the webhooks table
Also updated the columns constraints
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/442541
The one_target constraint makes it so that a webhook can only have values in one of the columns listed.
This was updated from:
`git_repository, branch, snap, livefs, oci_recipe, charm_recipe`
to
git_repository, branch, snap, livefs, oci_recipe, charm_recipe, project, distribution`
Note that the `source_package_name` column was not added, because when we set the target to be a `source_package_name`, we also add a `distribution` value
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ines-almeida/launchpad:add-new-target-columns-to-webhooks-table into launchpad:db-devel.
diff --git a/database/schema/patch-2211-19-0.sql b/database/schema/patch-2211-19-0.sql
new file mode 100644
index 0000000..d0f3a80
--- /dev/null
+++ b/database/schema/patch-2211-19-0.sql
@@ -0,0 +1,14 @@
+-- Copyright 2011 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 project integer REFERENCES product,
+ ADD COLUMN distribution integer REFERENCES distribution,
+ ADD COLUMN source_package_name integer REFERENCES sourcepackagename;
+
+ALTER TABLE Webhook DROP CONSTRAINT one_target;
+ALTER TABLE Webhook ADD CONSTRAINT one_target CHECK ((public.null_count(ARRAY[git_repository, branch, snap, livefs, oci_recipe, charm_recipe, project, distribution]) = 7));
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2211, 19, 0);
\ No newline at end of file