-- Per-invoice CC list for AR emails.
--
-- Customers sometimes ask to loop in additional people on a specific invoice
-- (the principal, the bookkeeper, a board treasurer) without making the change
-- permanent at the org level. This column stores those addresses as a
-- comma-separated string, matching the format ar-mailer's sendArEmail() already
-- accepts on its `cc` option. The external-recipient gate in
-- `checkRecipientGate` already iterates CC entries so no change there.
--
-- The new PUT /api/finance/ar/invoices/:id/ap-contact route writes this column.
-- It is also editable through the existing PUT /api/finance/ar/invoices/:id
-- route on pending invoices.

ALTER TABLE ar_invoices
  ADD COLUMN IF NOT EXISTS cc_emails TEXT DEFAULT NULL
  AFTER ap_phone;
