Files
accounted/supabase/migrations/20260807090100_inbox_mail_hunt_source.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

29 lines
1.0 KiB
SQL

ALTER TABLE public.invoice_inbox_items
DROP CONSTRAINT IF EXISTS invoice_inbox_items_source_check;
ALTER TABLE public.invoice_inbox_items
ADD CONSTRAINT invoice_inbox_items_source_check
CHECK (source IN ('email', 'upload', 'whatsapp', 'mail_hunt')) NOT VALID;
ALTER TABLE public.invoice_inbox_items
VALIDATE CONSTRAINT invoice_inbox_items_source_check;
ALTER TABLE public.document_attachments
DROP CONSTRAINT IF EXISTS document_attachments_upload_source_check;
ALTER TABLE public.document_attachments
ADD CONSTRAINT document_attachments_upload_source_check
CHECK (upload_source IN (
'camera', 'file_upload', 'email', 'e_invoice', 'scan', 'api', 'system',
'whatsapp', 'mail_hunt'
)) NOT VALID;
ALTER TABLE public.document_attachments
VALIDATE CONSTRAINT document_attachments_upload_source_check;
CREATE UNIQUE INDEX IF NOT EXISTS idx_invoice_inbox_mail_message_unique
ON public.invoice_inbox_items (company_id, ((channel_context->>'mail_message_id')))
WHERE source = 'mail_hunt';
NOTIFY pgrst, 'reload schema';