Files
accounted/supabase/migrations/20260514120000_invoice_inbox_book_direct.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

18 lines
799 B
SQL

-- Invoice inbox: support "book directly" flow for kontantmetoden users.
--
-- Cash-method users (and accrual users dealing with personal expenses,
-- cash receipts, etc.) need to be able to turn an inbox item directly
-- into a manual journal entry without going through a supplier invoice.
-- This column gives the inbox the third terminal status, symmetric with
-- `created_supplier_invoice_id` and `matched_transaction_id`.
ALTER TABLE public.invoice_inbox_items
ADD COLUMN IF NOT EXISTS created_journal_entry_id uuid
REFERENCES public.journal_entries(id) ON DELETE SET NULL;
CREATE INDEX IF NOT EXISTS idx_inbox_items_created_journal_entry
ON public.invoice_inbox_items(company_id, created_journal_entry_id)
WHERE created_journal_entry_id IS NOT NULL;
NOTIFY pgrst, 'reload schema';