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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 8cf09d69b86ad3311c3507af850b7f24174b73cd
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:db-artifactory-publish-2
Merge into: launchpad:master
Diff against target: 53 lines (+34/-2)
2 files modified
database/schema/patch-2210-44-0.sql (+0/-2)
database/schema/patch-2210-44-1.sql (+34/-0)
Reviewer Review Type Date Requested Status
William Grant db Approve
Review via email: mp+418280@code.launchpad.net

Commit message

Artifactory publishing: indexes

Description of the change

This will need to be applied live to production.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (db)
8cf09d6... by Colin Watson

Drop unnecessary binarypackagerelease__ci_build__idx

The non-NULL cases are covered by
binarypackagerelease__ci_build__bpn__key, and querying for the NULL
cases isn't interesting.

Revision history for this message
Colin Watson (cjwatson) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-44-0.sql b/database/schema/patch-2210-44-0.sql
2index 47c163d..144ab1c 100644
3--- a/database/schema/patch-2210-44-0.sql
4+++ b/database/schema/patch-2210-44-0.sql
5@@ -111,8 +111,6 @@ CREATE UNIQUE INDEX binarypackagerelease__build__bpn__key
6 CREATE UNIQUE INDEX binarypackagerelease__ci_build__bpn__key
7 ON BinaryPackageRelease (ci_build, binarypackagename)
8 WHERE ci_build IS NOT NULL;
9-CREATE INDEX binarypackagerelease__ci_build__idx
10- ON BinaryPackageRelease (ci_build);
11
12 ALTER TABLE BinaryPackageRelease
13 VALIDATE CONSTRAINT one_build,
14diff --git a/database/schema/patch-2210-44-1.sql b/database/schema/patch-2210-44-1.sql
15new file mode 100644
16index 0000000..a8d719c
17--- /dev/null
18+++ b/database/schema/patch-2210-44-1.sql
19@@ -0,0 +1,34 @@
20+-- Copyright 2022 Canonical Ltd. This software is licensed under the
21+-- GNU Affero General Public License version 3 (see the file LICENSE).
22+
23+SET client_min_messages=ERROR;
24+
25+-- STEP 2, HOT
26+
27+CREATE INDEX sourcepackagerelease__ci_build__idx
28+ ON SourcePackageRelease (ci_build);
29+
30+ALTER TABLE SourcePackageRelease
31+ VALIDATE CONSTRAINT at_most_one_build,
32+ VALIDATE CONSTRAINT debian_columns;
33+
34+ALTER TABLE SourcePackagePublishingHistory
35+ VALIDATE CONSTRAINT debian_columns,
36+ VALIDATE CONSTRAINT no_debian_channel;
37+
38+CREATE UNIQUE INDEX binarypackagerelease__build__bpn__key
39+ ON BinaryPackageRelease (build, binarypackagename)
40+ WHERE build IS NOT NULL;
41+CREATE UNIQUE INDEX binarypackagerelease__ci_build__bpn__key
42+ ON BinaryPackageRelease (ci_build, binarypackagename)
43+ WHERE ci_build IS NOT NULL;
44+
45+ALTER TABLE BinaryPackageRelease
46+ VALIDATE CONSTRAINT one_build,
47+ VALIDATE CONSTRAINT debian_columns;
48+
49+ALTER TABLE BinaryPackagePublishingHistory
50+ VALIDATE CONSTRAINT debian_columns,
51+ VALIDATE CONSTRAINT no_debian_channel;
52+
53+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 44, 1);

Subscribers

People subscribed via source and target branches

to status/vote changes: