← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] lp:~cjwatson/launchpad/close-account-hwsubmissiondevice into lp:launchpad

 


Diff comments:

> 
> === modified file 'lib/lp/registry/scripts/closeaccount.py'
> --- lib/lp/registry/scripts/closeaccount.py	2019-03-08 14:30:24 +0000
> +++ lib/lp/registry/scripts/closeaccount.py	2019-03-11 15:13:32 +0000
> @@ -332,6 +330,17 @@
>      skip.add(('archivesubscriber', 'subscriber'))
>      skip.add(('archiveauthtoken', 'person'))
>  
> +    # Remove hardware submissions.
> +    table_notification('HWSubmissionDevice')
> +    store.execute("""
> +        DELETE FROM HWSubmissionDevice
> +        USING HWSubmission
> +        WHERE HWSubmission.id = HWSubmissionDevice.submission
> +            AND owner = ?
> +        """, (person.id,))

Storm doesn't support DELETE ... USING (see bug 322972).  I suppose I could have fetched the IDs separately, but at that point it was a choice between two inelegant things, so I picked this one since it results in fewer queries.

> +    table_notification('HWSubmission')
> +    store.find(HWSubmission, HWSubmission.ownerID == person.id).remove()
> +
>      # Closing the account will only work if all references have been handled
>      # by this point.  If not, it's safer to bail out.  It's OK if this
>      # doesn't work in all conceivable situations, since some of them may


-- 
https://code.launchpad.net/~cjwatson/launchpad/close-account-hwsubmissiondevice/+merge/364260
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/close-account-hwsubmissiondevice into lp:launchpad.


References