← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/product-aps-db-2 into lp:launchpad/db-devel

 

William Grant has proposed merging lp:~wgrant/launchpad/product-aps-db-2 into lp:launchpad/db-devel with lp:~wgrant/launchpad/product-aps-set as a prerequisite.

Commit message:
Backfill Product.access_policies.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1452949 in Launchpad itself: "Timeout error while trying to access team site"
  https://bugs.launchpad.net/launchpad/+bug/1452949

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/product-aps-db-2/+merge/263063

Backfill Product.access_policies.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/product-aps-db-2 into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2209-67-2.sql'
--- database/schema/patch-2209-67-2.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-67-2.sql	2015-06-26 06:39:48 +0000
@@ -0,0 +1,15 @@
+-- Copyright 2015 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+UPDATE product
+    SET access_policies = (
+        SELECT array_agg(AccessPolicy.id)
+        FROM AccessPolicy
+        WHERE
+            AccessPolicy.product = Product.id
+            AND AccessPolicy.type IN (5, 6)) -- PROPRIETARY, EMBARGOED
+    WHERE information_type IN (5, 6);
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 67, 2);