Files
accounted/supabase/migrations/20260717070000_agi_follows_vat_taxable_base.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

20 lines
974 B
SQL

-- The 26th filing day for the skattedeklaration (AGI and VAT together) is
-- triggered by one statutory measure: a VAT taxable base above SEK 40 million
-- (SFL 26 kap.). No separate employer-turnover measure exists, so the split
-- introduced by 20260716120353 could show a non-VAT-reporting employer the
-- 26th when its binding AGI deadline is the 12th. Drop the employer column.
ALTER TABLE public.company_settings
DROP COLUMN IF EXISTS employer_turnover_over_40m;
-- Clear the VAT flag where the stored combination is not legally coherent
-- (the flag requires VAT registration and monthly reporting). Ambiguous
-- companies fall back to the small-company schedule, whose dates are always
-- earlier and therefore never produce a late filing.
UPDATE public.company_settings
SET vat_taxable_base_over_40m = false
WHERE vat_taxable_base_over_40m
AND (vat_registered IS DISTINCT FROM true OR moms_period IS DISTINCT FROM 'monthly');
NOTIFY pgrst, 'reload schema';