-- Migration 021: Add email_id to pipeline_opportunities for direct email linking
ALTER TABLE pipeline_opportunities
    ADD COLUMN IF NOT EXISTS email_id INTEGER REFERENCES email_messages(id) ON DELETE SET NULL;
CREATE INDEX IF NOT EXISTS idx_pipeline_opportunities_email_id ON pipeline_opportunities(email_id);
