← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:db-artifactory-publish-2 into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:db-artifactory-publish-2 into launchpad:master.

Commit message:
Artifactory publishing: indexes

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers): db

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

This will need to be applied live to production.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:db-artifactory-publish-2 into launchpad:master.
diff --git a/database/schema/patch-2210-44-1.sql b/database/schema/patch-2210-44-1.sql
new file mode 100644
index 0000000..ab17a66
--- /dev/null
+++ b/database/schema/patch-2210-44-1.sql
@@ -0,0 +1,36 @@
+-- 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;
+
+-- STEP 2, HOT
+
+CREATE INDEX sourcepackagerelease__ci_build__idx
+    ON SourcePackageRelease (ci_build);
+
+ALTER TABLE SourcePackageRelease
+    VALIDATE CONSTRAINT at_most_one_build,
+    VALIDATE CONSTRAINT debian_columns;
+
+ALTER TABLE SourcePackagePublishingHistory
+    VALIDATE CONSTRAINT debian_columns,
+    VALIDATE CONSTRAINT no_debian_channel;
+
+CREATE UNIQUE INDEX binarypackagerelease__build__bpn__key
+    ON BinaryPackageRelease (build, binarypackagename)
+    WHERE build IS NOT NULL;
+CREATE UNIQUE INDEX binarypackagerelease__ci_build__bpn__key
+    ON BinaryPackageRelease (ci_build, binarypackagename)
+    WHERE ci_build IS NOT NULL;
+CREATE INDEX binarypackagerelease__ci_build__idx
+    ON BinaryPackageRelease (ci_build);
+
+ALTER TABLE BinaryPackageRelease
+    VALIDATE CONSTRAINT one_build,
+    VALIDATE CONSTRAINT debian_columns;
+
+ALTER TABLE BinaryPackagePublishingHistory
+    VALIDATE CONSTRAINT debian_columns,
+    VALIDATE CONSTRAINT no_debian_channel;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 44, 1);