-- Migration 046: Add unique constraint on (profile_id, important_date_id) in gift_ideas
-- Purpose: Prevent race condition where two concurrent callers both pass an idempotency
--          check and insert duplicate rows for the same (profile_id, important_date_id) pair.
--
-- No deduplication step needed: table was verified to have 0 duplicate pairs before
-- this migration was created.

ALTER TABLE gift_ideas
  ADD UNIQUE KEY uq_gift_ideas_profile_date (profile_id, important_date_id);
