Zero-Downtime Database Migrations
Use Relay environments to cut over databases with no downtime.
Advanced Patterns
Database migrations can be risky and often require maintenance windows. By leveraging Relay's environment routing, you can seamlessly cut over to a new database without downtime.
1. Deploy backend v2
Deploy a new version of your backend (v2) on a new server. This new backend should connect directly to your new database instance.
2. Update staging environment
Update the Relay staging environment to point to the v2 backend URL. Your production traffic remains unaffected.
3. Test
Run your integration and end-to-end tests against the staging environment to verify that the new database and backend v2 are functioning correctly.
4. Update production environment
Once you are confident in the staging deployment, update the Relay production environment upstream URL to point to v2.
5. Instant traffic switch
Traffic switches instantly to the new backend and database without any DNS propagation delays. Your users experience zero downtime.