Closed Bug 496191 Opened 15 years ago Closed 15 years ago

Stop using bindFully on collections listing

Categories

(addons.mozilla.org Graveyard :: Collections, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jbalogh, Assigned: jbalogh)

Details

Attachments

(2 files, 1 obsolete file)

For reasons similar to bug 495512.
Depends on the patch in bug 495512.
Attachment #381392 - Flags: review?(clouserw)
Attachment #381392 - Flags: review?(clouserw) → review-
Comment on attachment 381392 [details] [diff] [review]
 pulling less data for collection listing, denormalizing addonCount

Binding only users is fine, but I don't like updating the count every time with another query.

Normally we'd use a cron for this stuff but let's try out a trigger and see how we like it:

CREATE TRIGGER collections_update_addon_count AFTER INSERT ON addons_collections FOR EACH ROW
  UPDATE collections SET collections.addonCount = collections.addonCount+1 WHERE collections.id=NEW.collection_id;

works for me.  Also, you'll need to make one for AFTER DELETE.  

_updateAddonCount() might be a handy function to have around, but let's not call it from addAddonToCollection()
Now with more trigger fingers.
Attachment #381392 - Attachment is obsolete: true
Attachment #381569 - Flags: review?(clouserw)
Comment on attachment 381569 [details] [diff] [review]
pulling less data for collection listing, denormalizing addonCount

thanks
Attachment #381569 - Flags: review?(clouserw) → review+
r27151.  Will need updates on the preview db.
Status: NEW → RESOLVED
Closed: 15 years ago
Keywords: push-needed
Resolution: --- → FIXED
removing "push-needed" from 105 AMO 5.0.6 bugs; filter on "I hate stephend!"
Keywords: push-needed
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: