-- Export Intel: favorieten + CRM koppeling metadata

ALTER TABLE export_market_entities
    ADD COLUMN IF NOT EXISTS is_favorite BOOLEAN NOT NULL DEFAULT FALSE,
    ADD COLUMN IF NOT EXISTS favorited_at TIMESTAMPTZ,
    ADD COLUMN IF NOT EXISTS crm_pushed_at TIMESTAMPTZ;

CREATE INDEX IF NOT EXISTS idx_export_entities_favorite
    ON export_market_entities(is_favorite) WHERE is_favorite = TRUE;

CREATE INDEX IF NOT EXISTS idx_export_entities_crm_client
    ON export_market_entities(client_id) WHERE client_id IS NOT NULL;
