launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28631
[Merge] ~cjwatson/launchpad:db-narrow-bpr-ci-build-unique-index into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:db-narrow-bpr-ci-build-unique-index into launchpad:master.
Commit message:
Add BPR (ci_build, binarypackagename, binpackageformat) index
Requested reviews:
William Grant (wgrant): db
Launchpad code reviewers (launchpad-reviewers): db
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/425220
We previously had a unique index on `BPR (ci_build, binarypackagename)`. However, this doesn't work well with multiple binary package formats in play: the same CI build might well build the same package as both a wheel and a Conda package. This hot patch adds a narrower index which also includes the format; once it's been applied, we can drop the broader index.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:db-narrow-bpr-ci-build-unique-index into launchpad:master.
diff --git a/database/schema/patch-2210-44-4.sql b/database/schema/patch-2210-44-4.sql
new file mode 100644
index 0000000..b86564f
--- /dev/null
+++ b/database/schema/patch-2210-44-4.sql
@@ -0,0 +1,10 @@
+-- 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 binarypackagerelease__ci_build__bpn__format__key
+ ON BinaryPackageRelease (ci_build, binarypackagename, binpackageformat)
+ WHERE ci_build IS NOT NULL;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 44, 4);