- ALTER TABLE profiles ADD COLUMN setup_completed boolean NOT NULL DEFAULT false - Backfill existing users with categories OR template items to true - UNION covers edge case users with template items but no categories
- DELETE duplicate budgets keeping oldest per (user_id, start_date) - ADD CONSTRAINT budgets_user_month_unique UNIQUE (user_id, start_date) - DELETE duplicate categories keeping oldest per (user_id, name) - ADD CONSTRAINT categories_user_name_unique UNIQUE (user_id, name) - Wrapped in single BEGIN/COMMIT transaction for atomicity