← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~lgp171188/launchpad:vulnerability-subscription-sql-hot-patch into launchpad:master

 

Guruprasad has proposed merging ~lgp171188/launchpad:vulnerability-subscription-sql-hot-patch into launchpad:master.

Commit message:
Add a unique partial index on AccessArtifact(vulnerability)

And validate the replaced `has_artifact` constraint


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

DO NOT MERGE until the predecessor DB patch is deployed to production and merged to `master`.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:vulnerability-subscription-sql-hot-patch into launchpad:master.
diff --git a/database/schema/patch-2211-02-1.sql b/database/schema/patch-2211-02-1.sql
new file mode 100644
index 0000000..dc12644
--- /dev/null
+++ b/database/schema/patch-2211-02-1.sql
@@ -0,0 +1,11 @@
+-- Copyright 2022 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+CREATE UNIQUE INDEX accessartifact__vulnerability__key
+    ON AccessArtifact(vulnerability) WHERE vulnerability IS NOT NULL;
+
+ALTER TABLE AccessArtifact VALIDATE CONSTRAINT has_artifact;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2211, 02, 4);