Files
accounted/supabase
Jakob Wennberg b5fc95276c fix: add missing default_voucher_series column to company_settings (#269)
* fix: add missing default_voucher_series column to company_settings

The /settings/bookkeeping form, TypeScript types, and Zod schema have all
referenced company_settings.default_voucher_series, but no migration ever
added it. Saving the setting failed with: "Could not find the
'default_voucher_series' column of 'company_settings' in the schema cache".

Adds the column (text NOT NULL DEFAULT 'A') with a CHECK constraint that
mirrors the Zod validation ([A-Z]), plus a PostgREST schema reload.

Migration already applied to production to unblock reporting users.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix: explicitly enforce NOT NULL and DEFAULT on default_voucher_series

ADD COLUMN IF NOT EXISTS silently skips the column definition when the
column already exists, so environments that got the column out-of-band
could end up with a different NOT NULL/DEFAULT attribute than a fresh boot.

Add explicit idempotent ALTER COLUMN statements that reassert both, with
a backfill pass so SET NOT NULL can't fail on legacy nullable rows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 14:32:22 +02:00
..