← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~enriqueesanchz/launchpad:update-bugattachment-reference-constraint into launchpad:master

 

Enrique Sánchez has proposed merging ~enriqueesanchz/launchpad:update-bugattachment-reference-constraint into launchpad:master.

Commit message:
Update bugattachment exactly_one_reference
    
Update bugattachment exactly_one_reference constraint in a hot patch

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~enriqueesanchz/launchpad/+git/launchpad/+merge/485304
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~enriqueesanchz/launchpad:update-bugattachment-reference-constraint into launchpad:master.
diff --git a/database/schema/patch-2211-38-0.sql b/database/schema/patch-2211-38-0.sql
new file mode 100644
index 0000000..ec64b1f
--- /dev/null
+++ b/database/schema/patch-2211-38-0.sql
@@ -0,0 +1,15 @@
+-- Copyright 2025 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 bugattachment
+    DROP CONSTRAINT exactly_one_reference,
+    ADD CONSTRAINT at_least_one_not_null
+    CHECK (
+        (libraryfile IS NOT NULL) OR
+        (url IS NOT NULL) OR
+        (vulnerability_patches IS NOT NULL)
+);
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2211, 38, 0);
diff --git a/lib/lp/bugs/scripts/uct/uctimport.py b/lib/lp/bugs/scripts/uct/uctimport.py
index 7e1a3a6..5ef2de5 100644
--- a/lib/lp/bugs/scripts/uct/uctimport.py
+++ b/lib/lp/bugs/scripts/uct/uctimport.py
@@ -239,6 +239,8 @@ class UCTImporter:
 
         bug.tags = cve.global_tags
 
+        bug.tags = cve.global_tags
+
         # Update or add new Vulnerabilities
         vulnerabilities_by_distro = {
             v.distribution: v for v in bug.vulnerabilities

Follow ups