Merge ~andrey-fedoseev/launchpad:db-bug-task-channel-indexes into launchpad:db-devel

Proposed by Andrey Fedoseev
Status: Needs review
Proposed branch: ~andrey-fedoseev/launchpad:db-bug-task-channel-indexes
Merge into: launchpad:db-devel
Prerequisite: ~andrey-fedoseev/launchpad:db-bug-task-channel
Diff against target: 67 lines (+61/-0)
1 file modified
database/schema/patch-2211-15-1.sql (+61/-0)
Reviewer Review Type Date Requested Status
Launchpad code reviewers Pending
Review via email: mp+434688@code.launchpad.net

Commit message

Include the new `channel` to the indexes

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

Not a full review yet, but I noticed a slight numbering discrepancy in combination with https://code.launchpad.net/~andrey-fedoseev/launchpad/+git/launchpad/+merge/434686: this should be 2211-14-1 rather than 2211-15-1. (I'll update dbpatches.)

Unmerged commits

e6129c0... by Andrey Fedoseev

Include the new `channel` to the indexes

Succeeded
[SUCCEEDED] docs:0 (build)
[SUCCEEDED] lint:0 (build)
[SUCCEEDED] mypy:0 (build)
13 of 3 results
52d9000... by Andrey Fedoseev

Add `channel` field to `BugTask` and its derived tables/views

Succeeded
[SUCCEEDED] docs:0 (build)
[SUCCEEDED] lint:0 (build)
[SUCCEEDED] mypy:0 (build)
13 of 3 results

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2211-15-1.sql b/database/schema/patch-2211-15-1.sql
2new file mode 100644
3index 0000000..cddc62d
4--- /dev/null
5+++ b/database/schema/patch-2211-15-1.sql
6@@ -0,0 +1,61 @@
7+-- Copyright 2022 Canonical Ltd. This software is licensed under the
8+-- GNU Affero General Public License version 3 (see the file LICENSE).
9+
10+SET client_min_messages=ERROR;
11+
12+-- Replacing previously renamed indexes.
13+CREATE UNIQUE INDEX bugtask_distinct_sourcepackage_assignment
14+ ON bugtask (
15+ bug,
16+ COALESCE(sourcepackagename, '-1'::integer),
17+ COALESCE(distroseries, '-1'::integer),
18+ COALESCE(distribution, '-1'::integer),
19+ COALESCE(channel, '{}'::jsonb)
20+ )
21+ WHERE (
22+ product IS NULL
23+ AND productseries IS NULL
24+ AND ociproject IS NULL
25+ AND ociprojectseries IS NULL
26+ );
27+DROP INDEX old__bugtask_distinct_sourcepackage_assignment;
28+
29+
30+CREATE UNIQUE INDEX bugsummary__unique
31+ ON bugsummary (
32+ COALESCE(product, '-1'::integer),
33+ COALESCE(productseries, '-1'::integer),
34+ COALESCE(distribution, '-1'::integer),
35+ COALESCE(distroseries, '-1'::integer),
36+ COALESCE(sourcepackagename, '-1'::integer),
37+ COALESCE(ociproject, '-1'::integer),
38+ COALESCE(ociprojectseries, '-1'::integer),
39+ COALESCE(channel, '{}'::jsonb),
40+ status,
41+ importance,
42+ has_patch,
43+ COALESCE(tag, ''::text),
44+ COALESCE(milestone, '-1'::integer),
45+ COALESCE(viewed_by, '-1'::integer),
46+ COALESCE(access_policy, '-1'::integer)
47+);
48+DROP INDEX old__bugsummary__unique;
49+
50+CREATE INDEX bugsummaryjournal__full__idx
51+ ON bugsummaryjournal (
52+ status,
53+ product,
54+ productseries,
55+ distribution,
56+ distroseries,
57+ sourcepackagename,
58+ ociproject,
59+ ociprojectseries,
60+ channel,
61+ viewed_by,
62+ milestone,
63+ tag
64+ );
65+DROP INDEX old__bugsummaryjournal__full__idx;
66+
67+INSERT INTO LaunchpadDatabaseRevision VALUES (2211, 15, 1);

Subscribers

People subscribed via source and target branches

to status/vote changes: