ALTER TABLE purchases
  ADD COLUMN share_slug_id uuid
    REFERENCES share_links(id) ON DELETE SET NULL;

CREATE INDEX purchases_share_slug_idx
  ON purchases(share_slug_id)
  WHERE share_slug_id IS NOT NULL;
