Files
accounted/supabase/migrations/20260824133122_agi_tax_payment_format_pain001.sql
Jakob Wennberg d2251736a2 fix(migrations): reconcile agi_tax_payment_format_pain001 to its applied version 20260824133122 (#1857)
Two repo migrations shared version 20260824120000 (#1829's
match_batch_allocate_ore_settlement and #1845's
agi_tax_payment_format_pain001). Prod's schema_migrations shows the AGI
one applied as 20260824133122, so the repo had an orphan on prod and a
duplicate version locally. Every Supabase preview branch since then
fails with "duplicate key value violates unique constraint
schema_migrations_pkey (20260824120000)" (seen on #1852).

Content is untouched; only the filename now matches the version prod
actually recorded, per the never-leave-remote-ahead rule.


Claude-Session: https://claude.ai/code/session_01ScVhg6XsDtNXkiEQNV7LaZ

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 16:09:16 +02:00

17 lines
763 B
SQL

-- Allow ISO 20022 pain.001 as a tax payment file format.
--
-- The skattekonto payment file (skatt + arbetsgivaravgifter to Skatteverket
-- BG 5050-1055) was Bankgirot LB only; banks are sunsetting LB file uploads
-- during 2026 and companies on pain.001 for salary need the same format for
-- the tax payment. The route now generates either format, so the CHECK on
-- agi_declarations.tax_payment_file_format must admit 'pain001'.
ALTER TABLE public.agi_declarations
DROP CONSTRAINT IF EXISTS agi_declarations_tax_payment_format_check;
ALTER TABLE public.agi_declarations
ADD CONSTRAINT agi_declarations_tax_payment_format_check
CHECK (tax_payment_file_format IS NULL OR tax_payment_file_format IN ('bg_lb', 'pain001'));
NOTIFY pgrst, 'reload schema';