Merge ~cjwatson/launchpad:merge-db-stable into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 093a50631ac44f0b26b22eac888ed59cdfa9f7d2
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:merge-db-stable
Merge into: launchpad:master
Diff against target: 40 lines (+34/-0)
1 file modified
database/schema/patch-2210-41-0.sql (+34/-0)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+415304@code.launchpad.net

Commit message

Merge db-stable 093a50631a (Add distribution privacy columns)

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

Deployed to the production database today.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-41-0.sql b/database/schema/patch-2210-41-0.sql
2new file mode 100644
3index 0000000..64f2bf4
4--- /dev/null
5+++ b/database/schema/patch-2210-41-0.sql
6@@ -0,0 +1,34 @@
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+ALTER TABLE Distribution
13+ ADD COLUMN branch_sharing_policy integer DEFAULT 1 NOT NULL,
14+ ADD COLUMN bug_sharing_policy integer DEFAULT 1 NOT NULL,
15+ ADD COLUMN specification_sharing_policy integer DEFAULT 1 NOT NULL,
16+ ADD COLUMN information_type integer DEFAULT 1 NOT NULL,
17+ ADD COLUMN access_policies integer[],
18+ ADD CONSTRAINT distribution__valid_information_type CHECK (
19+ information_type = ANY(ARRAY[1, 5, 6]));
20+
21+COMMENT ON COLUMN Distribution.branch_sharing_policy IS 'Sharing policy for this distribution''s branches.';
22+COMMENT ON COLUMN Distribution.bug_sharing_policy IS 'Sharing policy for this distribution''s bugs.';
23+COMMENT ON COLUMN Distribution.specification_sharing_policy IS 'Sharing policy for this distribution''s specifications.';
24+COMMENT ON COLUMN Distribution.information_type IS 'Enum describing what type of information is stored, such as type of private or security related data, and used to determine how to apply an access policy.';
25+COMMENT ON COLUMN Distribution.access_policies IS 'Cache of AccessPolicy.ids that convey launchpad.LimitedView.';
26+
27+ALTER TABLE CommercialSubscription
28+ ADD COLUMN distribution integer REFERENCES distribution,
29+ ALTER COLUMN product DROP NOT NULL,
30+ ADD CONSTRAINT one_pillar CHECK (null_count(ARRAY[product, distribution]) = 1);
31+
32+DROP INDEX commercialsubscription__product__idx;
33+CREATE UNIQUE INDEX commercialsubscription__product__idx
34+ ON CommercialSubscription (product) WHERE product IS NOT NULL;
35+CREATE UNIQUE INDEX commercialsubscription__distribution__idx
36+ ON CommercialSubscription (distribution) WHERE distribution IS NOT NULL;
37+
38+COMMENT ON COLUMN CommercialSubscription.distribution IS 'The distribution this subscription enables.';
39+
40+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 41, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: