Merge lp:~benji/launchpad/bug-877195-db-3 into lp:launchpad

Proposed by Benji York on 2011-11-28
Status: Rejected
Rejected by: Benji York on 2011-11-28
Proposed branch: lp:~benji/launchpad/bug-877195-db-3
Merge into: lp:launchpad
Diff against target: 108 lines (+47/-1)
6 files modified
database/replication/helpers.py (+10/-1)
database/schema/comments.sql (+3/-0)
database/schema/patch-2208-01-3.sql (+17/-0)
database/schema/patch-2208-93-2.sql (+13/-0)
database/schema/security.cfg (+3/-0)
lib/lp/code/doc/branch.txt (+1/-0)
To merge this branch: bzr merge lp:~benji/launchpad/bug-877195-db-3
Reviewer Review Type Date Requested Status
Robert Collins 2011-11-28 Pending
Stuart Bishop 2011-11-28 Pending
Launchpad code reviewers 2011-11-28 Pending
Review via email: mp+83623@code.launchpad.net

This proposal supersedes a proposal from 2011-11-25.

Description of the change

add some security declarations for template statistics jobs

To post a comment you must log in.
Robert Collins (lifeless) wrote : Posted in a previous version of this proposal

Heh, actually this doens't need DB review per the DB review process - this is just a normal code review.

Robert Collins (lifeless) : Posted in a previous version of this proposal
review: Approve
Stuart Bishop (stub) wrote : Posted in a previous version of this proposal

yer

review: Approve
Benji York (benji) wrote :

Robert Collins wrote:
> Heh, actually this doens't need DB review per the DB review process -
> this is just a normal code review.

My mistake. Retargeting to devel.

Benji York (benji) wrote :

Well, since this was a branch of db-devel, that (retargeting won't work). I'll make a new branch with this content and self-approve with a comment pointing here.

Stuart Bishop (stub) wrote :

Normally this should land on db-devel. If you land it on devel, technically you would need someone to manually apply the permissions to production before landing. Otherwise, code landings may depend on the new permissions that have not been applied to the production db yet.

Unmerged revisions

11171. By Benji York on 2011-11-25

add some security declarations for template statistics jobs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/replication/helpers.py'
2--- database/replication/helpers.py 2011-10-13 03:52:48 +0000
3+++ database/replication/helpers.py 2011-11-28 15:43:50 +0000
4@@ -44,7 +44,6 @@
5 ('public', 'openidnonce'),
6 ('public', 'openidassociation'),
7 ('public', 'person'),
8- ('public', 'launchpaddatabaserevision'),
9 ('public', 'databasereplicationlag'),
10 ('public', 'fticache'),
11 ('public', 'nameblacklist'),
12@@ -63,6 +62,16 @@
13 # suggestivepotemplate.potemplate foreign key constraint exists on
14 # production.
15 ('public', 'suggestivepotemplate'),
16+ # These are odd. They are updated via slonik & EXECUTE SCRIPT, and
17+ # the contents of these tables will be different on each node
18+ # because we store timestamps when the patches were applied.
19+ # However, we want the tables listed as replicated so that, when
20+ # building a new replica, the data that documents the schema patch
21+ # level matches the schema patch level and upgrade.py does the right
22+ # thing. This is a bad thing to do, but we are safe in this
23+ # particular case.
24+ ('public', 'launchpaddatabaserevision'),
25+ ('public', 'launchpaddatabaseupdatelog'),
26 ])
27
28 # Explicitly list tables that should not be replicated. This includes the
29
30=== modified file 'database/schema/comments.sql'
31--- database/schema/comments.sql 2011-11-16 01:19:54 +0000
32+++ database/schema/comments.sql 2011-11-28 15:43:50 +0000
33@@ -1223,6 +1223,9 @@
34 COMMENT ON COLUMN LaunchpadDatabaseRevision.minor IS 'Minor number. Patches made during development each increment the minor number.';
35 COMMENT ON COLUMN LaunchpadDatabaseRevision.patch IS 'The patch number will hopefully always be ''0'', as it exists to support emergency patches made to the production server. eg. If production is running ''4.0.0'' and needs to have a patch applied ASAP, we would create a ''4.0.1'' patch and roll it out. We then may need to refactor all the existing ''4.x.0'' patches.';
36
37+-- LaunchpadDatabaseUpdateLog
38+COMMENT ON TABLE LaunchpadDatabaseUpdateLog IS 'Record of Launchpad database schema updates. When and what update.py was run.';
39+
40 -- Karma
41 COMMENT ON TABLE Karma IS 'Used to quantify all the ''operations'' a user performs inside the system, which maybe reporting and fixing bugs, uploading packages, end-user support, wiki editting, etc.';
42 COMMENT ON COLUMN Karma.action IS 'A foreign key to the KarmaAction table.';
43
44=== added file 'database/schema/patch-2208-01-3.sql'
45--- database/schema/patch-2208-01-3.sql 1970-01-01 00:00:00 +0000
46+++ database/schema/patch-2208-01-3.sql 2011-11-28 15:43:50 +0000
47@@ -0,0 +1,17 @@
48+SET client_min_messages=ERROR;
49+
50+ALTER TABLE LaunchpadDatabaseRevision
51+ ADD branch_nick text,
52+ ADD revno integer,
53+ ADD revid text;
54+
55+CREATE TABLE LaunchpadDatabaseUpdateLog (
56+ id serial primary key,
57+ start_time timestamp without time zone NOT NULL DEFAULT (
58+ CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
59+ end_time timestamp without time zone,
60+ branch_nick text,
61+ revno integer,
62+ revid text);
63+
64+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 01, 3);
65
66=== added file 'database/schema/patch-2208-93-2.sql'
67--- database/schema/patch-2208-93-2.sql 1970-01-01 00:00:00 +0000
68+++ database/schema/patch-2208-93-2.sql 2011-11-28 15:43:50 +0000
69@@ -0,0 +1,13 @@
70+-- Copyright 2011 Canonical Ltd. This software is licensed under the
71+-- GNU Affero General Public License version 3 (see the file LICENSE).
72+SET client_min_messages=ERROR;
73+
74+ALTER TABLE AccessPolicyGrant ADD CONSTRAINT
75+ "accesspolicygrant_grantee_fkey" FOREIGN KEY (grantee) REFERENCES Person;
76+ALTER TABLE AccessPolicyGrant ADD CONSTRAINT
77+ "accesspolicygrant_grantor_fkey" FOREIGN KEY (grantor) REFERENCES Person;
78+
79+ALTER TABLE AccessPolicyArtifact ADD CONSTRAINT
80+ "accesspolicyartifact_branch_fkey" FOREIGN KEY (branch) REFERENCES Branch;
81+
82+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 93, 2);
83
84=== modified file 'database/schema/security.cfg'
85--- database/schema/security.cfg 2011-11-22 14:12:40 +0000
86+++ database/schema/security.cfg 2011-11-28 15:43:50 +0000
87@@ -445,6 +445,9 @@
88 public.job = SELECT, UPDATE, DELETE
89 public.pofilestatsjob = SELECT, UPDATE, DELETE
90 public.potmsgset = SELECT
91+public.distroseries = SELECT
92+public.distribution = SELECT
93+public.sourcepackagename = SELECT
94 public.translationmessage = SELECT
95 public.translationtemplateitem = SELECT
96 type=user
97
98=== modified file 'lib/lp/code/doc/branch.txt'
99--- lib/lp/code/doc/branch.txt 2011-05-27 19:53:20 +0000
100+++ lib/lp/code/doc/branch.txt 2011-11-28 15:43:50 +0000
101@@ -389,6 +389,7 @@
102 ... ])
103 >>> for name in listing:
104 ... print name
105+ accesspolicyartifact.branch
106 branch.stacked_on
107 branchjob.branch
108 branchmergeproposal.dependent_branch