Merge lp:~wgrant/launchpad/bug-mirror-access-policies into lp:launchpad/db-devel
Status: | Merged |
---|---|
Merged at revision: | 11413 |
Proposed branch: | lp:~wgrant/launchpad/bug-mirror-access-policies |
Merge into: | lp:launchpad/db-devel |
Prerequisite: | lp:~wgrant/launchpad/multipolicy-4 |
Diff against target: |
426 lines (+406/-0) 3 files modified
database/schema/patch-2209-11-3.sql (+192/-0) database/schema/security.cfg (+1/-0) lib/lp/bugs/tests/test_bug_mirror_access_triggers.py (+213/-0) |
To merge this branch: | bzr merge lp:~wgrant/launchpad/bug-mirror-access-policies |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stuart Bishop (community) | db + tests | Approve | |
Robert Collins | db | Pending | |
Review via email: mp+94722@code.launchpad.net |
Commit message
Triggers to mirror legacy bug disclosure into the new access policy schema.
Description of the change
This branch adds a PL/pgSQL function to mirror legacy bug disclosure (Bug, BugTask, BugSubscription) to the new schema (AccessArtifact, AccessArtifactG
The mapping should be reasonably clear. If the bug is private, the set of AccessPolicyArt
This hasn't been tested on the stagings, only dogfood. On DF it performs at an average of ~0.8ms per bug when doing an initial population pass over every bug.
There are tests for most of the trigger and function behaviour.
On Mon, Feb 27, 2012 at 1:36 PM, William Grant <email address hidden> wrote:
> + INSERT INTO AccessArtifactGrant .person) .person, .subscribed_ by, BugSubscription .date_created Grant.grantee = .person rant.artifact = artifact_id) rant.grantee IS NULL
> + (artifact, grantee, grantor, date_created)
> + SELECT DISTINCT ON (artifact_id, BugSubscription
> + artifact_id, BugSubscription
> + BugSubscription
> + FROM
> + BugSubscription
> + LEFT JOIN AccessArtifactGrant
> + ON (AccessArtifact
> + BugSubscription
> + AND AccessArtifactG
> + WHERE
> + AccessArtifactG
> + AND BugSubscription.bug = bug_id;
You need an ORDER BY clause here for the SELECT DISTINCT ON. I think .person, .date_created" .
"ORDER BY artifact_id, BugSubscription
BugSubscription
Tests look good.
--
Stuart Bishop <email address hidden>