launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31380
[Merge] ~jugmac00/launchpad:fix-webhook-constraint-second-attempt into launchpad:db-devel
Jürgen Gmach has proposed merging ~jugmac00/launchpad:fix-webhook-constraint-second-attempt into launchpad:db-devel.
Commit message:
Fix webhook constraints
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/472574
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:fix-webhook-constraint-second-attempt into launchpad:db-devel.
diff --git a/database/schema/patch-2211-28-0.sql b/database/schema/patch-2211-28-0.sql
index fd01255..ad8078c 100644
--- a/database/schema/patch-2211-28-0.sql
+++ b/database/schema/patch-2211-28-0.sql
@@ -196,8 +196,9 @@ ALTER TABLE Webhook ADD COLUMN rock_recipe integer REFERENCES RockRecipe;
ALTER TABLE Webhook DROP CONSTRAINT one_target;
ALTER TABLE Webhook
ADD CONSTRAINT one_target CHECK (
- null_count(ARRAY[git_repository, branch, snap, livefs, oci_recipe,
- charm_recipe, rock_recipe]) = 6);
+ (public.null_count(ARRAY[git_repository, branch, snap, livefs, oci_recipe, charm_recipe, rock_recipe, project, distribution]) = 8) AND
+ (source_package_name IS NULL OR distribution IS NOT NULL)
+ );
CREATE INDEX webhook__rock_recipe__id__idx
ON Webhook (rock_recipe, id) WHERE rock_recipe IS NOT NULL;