26th October 2024 — Server-side database migration system #68
A comprehensive server-side migration management system using migrate-mongo, allowing administrators to simulate, monitor, and control database migrations through the admin interface with persistent simulation mode, real-time WebSocket progress tracking, and protective route guards.
Where to Find It
- Admin → Maintenance: Migration management interface with simulation controls
- Route Protection: Automatic access blocking when migrations are pending or failed
Benefits
- Safe Testing: Simulation mode allows testing migrations without affecting production data
- Real-Time Monitoring: WebSocket integration provides live updates during execution
- Automatic Protection: Route guards prevent system access during migration issues
- Persistent State: Simulation state persists across server restarts for reliable testing
- Health Integration: System health checks reflect migration status
View of successfully applied database migrations

View of simulation of failed database migrations

View of maintenance page from non-logged in perspective

Centralise environment variables (refs #68) (b93c69b)
Environment configuration refactored with type-safe enum, migration system enhancements for database-driven status, and improved health monitoring. Migration file detection now excludes TypeScript declaration files and provides consistent status across all environments.
Benefits
- Type Safety: Environment variables use TypeScript enums with IDE autocomplete
- Deployment Reliability: Server starts even when NODE_ENV not explicitly set (defaults to "development")
- Consistent Migration Display: Database-driven status shows same files locally and in production
- Improved Monitoring: Health checks accurately reflect migration state for automated alerts
- Cleaner Logs: TypeScript declaration files no longer incorrectly identified as migrations
- Better Maintainability: Centralised environment variable definitions
- Database-Driven Status: Migration state purely from database, independent of environment
- Improved File Detection: Filters exclude .d.ts and .d.js files, normalise .ts/.js handling