-- Rename overallStatus value Security Details -> Security Deposit (canonical label from APPLICATION_STATUS.SECURITY_DETAILS). -- Run once per environment AFTER deploying code that uses 'Security Deposit'. -- -- 1) Discover enum type name for applications.overallStatus: -- SELECT c.column_name, c.udt_name -- FROM information_schema.columns c -- WHERE c.table_schema = 'public' AND c.table_name = 'applications' AND c.column_name = 'overallStatus'; -- -- 2) Add new enum value (PostgreSQL 9.1+). Replace type name if yours differs. -- ALTER TYPE "enum_applications_overallStatus" ADD VALUE IF NOT EXISTS 'Security Deposit'; -- -- 3) Backfill rows (camelCase column is typical for this Sequelize project). -- UPDATE applications SET "overallStatus" = 'Security Deposit' WHERE "overallStatus" = 'Security Details'; -- -- 4) Backfill ApplicationProgress pipeline stage label (see ONBOARDING_STAGES in progress.ts). -- UPDATE application_progress SET "stageName" = 'Security Deposit' WHERE "stageName" = 'Security Details'; -- Minimal safe block: only step 3+4 if you use VARCHAR-like enums; for native ENUM you must run step 2 first (cannot be in same transaction as use of new value on older PG — run ADD VALUE, COMMIT, then UPDATE).