launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28047
[Merge] ~cjwatson/launchpad:db-private-distributions into launchpad:db-devel
Colin Watson has proposed merging ~cjwatson/launchpad:db-private-distributions into launchpad:db-devel.
Commit message:
Add distribution privacy columns
Requested reviews:
William Grant (wgrant): db
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/415113
These parallel those for projects.
I'm backfilling existing rows directly in this cold patch, since the `Distribution` table is small and rarely updated so it's unlikely to cause contention.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:db-private-distributions into launchpad:db-devel.
diff --git a/database/schema/patch-2210-41-0.sql b/database/schema/patch-2210-41-0.sql
new file mode 100644
index 0000000..bd83efd
--- /dev/null
+++ b/database/schema/patch-2210-41-0.sql
@@ -0,0 +1,20 @@
+-- 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;
+
+ALTER TABLE Distribution
+ ADD COLUMN branch_sharing_policy integer DEFAULT 1 NOT NULL,
+ ADD COLUMN bug_sharing_policy integer DEFAULT 1 NOT NULL,
+ ADD COLUMN specification_sharing_policy integer DEFAULT 1 NOT NULL,
+ ADD COLUMN information_type integer DEFAULT 1 NOT NULL,
+ ADD COLUMN access_policies integer[],
+ ADD CONSTRAINT distribution__valid_information_type CHECK (
+ information_type = ANY(ARRAY[1, 5, 6]));
+
+ALTER TABLE CommercialSubscription
+ ADD COLUMN distribution integer REFERENCES distribution,
+ ALTER COLUMN product DROP NOT NULL,
+ ADD CONSTRAINT one_pillar CHECK (null_count(ARRAY[product, distribution]) = 1);
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 41, 0);