3556
3556
WHERE bug_supervisor=%(from_id)d
3559
def _mergeStructuralSubscriptions(self, cur, from_id, to_id):
3560
# Update StructuralSubscription entries that will not conflict.
3561
# We separate this out from the parent query primarily to help
3562
# keep within our line length constraints, though it might make
3563
# things more readable otherwise as well.
3565
SELECT StructuralSubscription.id
3566
FROM StructuralSubscription
3567
WHERE StructuralSubscription.subscriber=%(to_id)d AND (
3568
StructuralSubscription.product=SSub.product
3570
StructuralSubscription.project=SSub.project
3572
StructuralSubscription.distroseries=SSub.distroseries
3574
StructuralSubscription.milestone=SSub.milestone
3576
StructuralSubscription.productseries=SSub.productseries
3578
(StructuralSubscription.distribution=SSub.distribution
3579
AND StructuralSubscription.sourcepackagename IS NULL
3580
AND SSub.sourcepackagename IS NULL)
3582
(StructuralSubscription.sourcepackagename=
3583
SSub.sourcepackagename
3584
AND StructuralSubscription.sourcepackagename=
3585
SSub.sourcepackagename)
3589
UPDATE StructuralSubscription
3590
SET subscriber=%(to_id)d
3591
WHERE subscriber=%(from_id)d AND id NOT IN (
3593
FROM StructuralSubscription AS SSub
3595
SSub.subscriber=%(from_id)d
3596
AND EXISTS (''' + exists_query + ''')
3599
# Delete the rest. We have to explicitly delete the bug subscription
3600
# filters first because there is not a cascade delete set up in the
3603
DELETE FROM BugSubscriptionFilter
3604
WHERE structuralsubscription IN (
3606
FROM StructuralSubscription
3607
WHERE subscriber=%(from_id)d)
3610
DELETE FROM StructuralSubscription WHERE subscriber=%(from_id)d
3559
3613
def _mergeSpecificationFeedback(self, cur, from_id, to_id):
3560
3614
# Update the SpecificationFeedback entries that will not conflict
3561
3615
# and trash the rest.
3982
4036
self._mergePackageBugSupervisor(cur, from_id, to_id)
3983
4037
skip.append(('packagebugsupervisor', 'bug_supervisor'))
4039
self._mergeStructuralSubscriptions(cur, from_id, to_id)
4040
skip.append(('structuralsubscription', 'subscriber'))
3985
4042
self._mergeSpecificationFeedback(cur, from_id, to_id)
3986
4043
skip.append(('specificationfeedback', 'reviewer'))
3987
4044
skip.append(('specificationfeedback', 'requester'))