Files
accounted/supabase/migrations/20260712140100_articles_add_currency.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

15 lines
692 B
SQL

-- Articles: optional default currency for the article's price.
--
-- Pre-fills the invoice currency when the article is added to a line (the
-- invoice still carries a single currency; the article supplies the default).
-- 'SEK' = the existing behaviour. Master data only, never posted; the frozen
-- invoice line keeps its own currency, so editing this never moves a voucher.
--
-- Validity is enforced by a FK to public.currencies, NOT a literal CHECK list,
-- so the supported set lives in one place (the currencies table).
ALTER TABLE public.articles
ADD COLUMN IF NOT EXISTS currency text NOT NULL DEFAULT 'SEK'
REFERENCES public.currencies(code);
NOTIFY pgrst, 'reload schema';