refactor(mitglieder): replace legacy status values (passiv/anwärter/ausgetreten/…) with aktiv/kind/jugend/reserve across backend, frontend, and sync

This commit is contained in:
Matthias Hochmeister
2026-04-15 19:43:18 +02:00
parent c1de8bd163
commit 260b71baf8
11 changed files with 84 additions and 67 deletions

View File

@@ -0,0 +1,16 @@
-- Migration: 090_update_status_values
-- Replace old status values with FDISK-aligned values: aktiv, kind, jugend, reserve.
-- Old values passiv, ehrenmitglied, jugendfeuerwehr, anwärter, ausgetreten are removed.
-- Idempotent: safe to run multiple times.
-- 1. Drop existing CHECK constraint
ALTER TABLE mitglieder_profile DROP CONSTRAINT IF EXISTS mitglieder_profile_status_check;
-- 2. Migrate existing data
UPDATE mitglieder_profile SET status = 'jugend' WHERE status = 'jugendfeuerwehr';
UPDATE mitglieder_profile SET status = NULL
WHERE status IN ('passiv', 'ehrenmitglied', 'anwärter', 'ausgetreten');
-- 3. Re-add CHECK with new allowed values (NULL still allowed for profiles without FDISK sync)
ALTER TABLE mitglieder_profile ADD CONSTRAINT mitglieder_profile_status_check
CHECK (status IS NULL OR status IN ('aktiv', 'kind', 'jugend', 'reserve'));