-- Composite indexes to make the 7-day trending aggregation fast.
-- Each index covers the date filter first, then sticker_id for the GROUP BY.
-- Without these the CTEs do full table scans → 100s response times.

ALTER TABLE sticker_likes
  ADD INDEX idx_likes_created_sticker (createdAt, sticker_id);

ALTER TABLE sticker_downloads
  ADD INDEX idx_downloads_created_sticker (createdAt, sticker_id);

ALTER TABLE sticker_shares
  ADD INDEX idx_shares_created_sticker (createdAt, sticker_id);

ALTER TABLE sticker_view
  ADD INDEX idx_view_created_sticker (createdAt, sticker_id);
