Files
accounted/supabase/migrations/20260305161912_fix_vat_account_names.sql
T
Jakob Wennberg b0de46790a fix: align local migrations with deployed Supabase state
Rename migration files (039-052) from sequential to real deployed
timestamps, add 11 missing migration files that were applied directly
to production, apply invoice_delivery_note_sequences migration, and
rename placeholder files for clarity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 10:16:22 +01:00

16 lines
789 B
SQL

-- Migration 52: Fix incorrect VAT account names for existing users
--
-- Migration 009 seeded accounts 2610/2611/2612 with wrong names:
-- 2610 → "Utgaende moms 25%" (should not exist; 2611 is the correct account)
-- 2611 → "Utgaende moms 12%" (WRONG — 2611 is 25%, 2621 is 12%)
-- 2612 → "Utgaende moms 6%" (WRONG — 2612 doesn't exist in BAS, 2631 is 6%)
--
-- Migration 021 fixed the seed function for new users but didn't fix existing data.
-- This migration corrects the account_name for any existing rows.
-- Fix 2611: was incorrectly labeled as 12%, should be 25%
UPDATE public.chart_of_accounts
SET account_name = 'Utgaende moms forsaljning 25%', updated_at = now()
WHERE account_number = '2611'
AND account_name IN ('Utgaende moms 12%', 'Utgående moms 12%');