Files
yourpart-daemon/migrations/002_falukant_family_rename_legacy_columns.sql
Torsten Schulz (local) 8f8fb8418a
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 2m45s
Ändere Dateiberechtigungen auf ausführbar für mehrere Dateien
2026-07-16 09:16:49 +02:00

19 lines
702 B
SQL
Executable File

-- Upgrade falls bereits 001 mit alten Spaltennamen eingespielt wurde.
-- Neuinstallationen nutzen 001 direkt und brauchen 002 nicht.
DO $$
BEGIN
IF EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_schema = 'falukant_data' AND table_name = 'relationship_state'
AND column_name = 'consecutive_underpayment_months'
) THEN
ALTER TABLE falukant_data.relationship_state
RENAME COLUMN consecutive_underpayment_months TO months_underfunded;
END IF;
END $$;
ALTER TABLE falukant_data.relationship_state
ADD COLUMN IF NOT EXISTS last_daily_processed_at timestamptz,
ADD COLUMN IF NOT EXISTS last_monthly_processed_at timestamptz;