Files
accounted/supabase/migrations/20260803231000_customer_invoice_metadata.sql
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

27 lines
1.3 KiB
SQL

-- Customer-level invoice delivery metadata carried by provider migrations.
-- NULL means the provider/user has not configured the field; an empty array
-- is an explicit "no copy recipients" choice and must survive re-syncs.
ALTER TABLE public.customers
ADD COLUMN contact_person text,
ADD COLUMN invoice_email_cc_addresses text[],
ADD COLUMN invoice_email_bcc_addresses text[];
ALTER TABLE public.customers
ADD CONSTRAINT customers_contact_person_length_check
CHECK (contact_person IS NULL OR char_length(contact_person) <= 200),
ADD CONSTRAINT customers_invoice_email_copy_recipient_limit_check
CHECK (
cardinality(COALESCE(invoice_email_cc_addresses, '{}'::text[]))
+ cardinality(COALESCE(invoice_email_bcc_addresses, '{}'::text[]))
<= 19
);
COMMENT ON COLUMN public.customers.contact_person IS
'Customer contact/reference person used by provider migrations and invoicing.';
COMMENT ON COLUMN public.customers.invoice_email_cc_addresses IS
'Customer-specific invoice CC recipients. NULL means unconfigured; empty means explicitly none.';
COMMENT ON COLUMN public.customers.invoice_email_bcc_addresses IS
'Customer-specific invoice BCC recipients. NULL means unconfigured; empty means explicitly none.';
NOTIFY pgrst, 'reload schema';