-- Migration 140: Add vendor extraction fields to email_messages
-- Stores vendor info extracted from attached invoice PDFs

ALTER TABLE email_messages
    ADD COLUMN IF NOT EXISTS extracted_vendor_name  VARCHAR(255),
    ADD COLUMN IF NOT EXISTS extracted_vendor_cvr   VARCHAR(20),
    ADD COLUMN IF NOT EXISTS extracted_invoice_date DATE;

COMMENT ON COLUMN email_messages.extracted_vendor_name  IS 'Vendor name from attached invoice PDF';
COMMENT ON COLUMN email_messages.extracted_vendor_cvr   IS 'Vendor CVR from attached invoice PDF';
COMMENT ON COLUMN email_messages.extracted_invoice_date IS 'Invoice date from attached invoice PDF';
