Migrations
- Optional fields — New optional fields with defaults don't require a migration; Mongoose handles them.
- password → passwordHash — Legacy users may have a
passwordfield; the scriptmigrate-password-to-password-hash.jsnormalizes them. Run it after restoring a backup (e.g. into TEST_PROD) so logins work. - When to run — After any restore from a backup that might contain old schema data; CI does this for the E2E baseline.
Related: Backups and restore, Models and schema