-- Migration 081: Add alert_threshold to buchhaltung_konten + default setting

ALTER TABLE buchhaltung_konten
  ADD COLUMN IF NOT EXISTS alert_threshold INT CHECK (alert_threshold BETWEEN 0 AND 100);

INSERT INTO buchhaltung_einstellungen (key, value)
VALUES ('default_alert_threshold', '"80"')
ON CONFLICT (key) DO NOTHING;
