When working with websites that are likely to have active users at any time and you can't have downtime, deploying database changes with your code changes can be an issue. You need to either deploy changes in a way that they can go out at different times without causing issues or deploy database changes that take effect at the same time as the code changes.
Concerns during database deploys
- No downtime
- Possible bugs
- Rolling back code
- Data changes
- Possible long-running tasks (import data, big data updates, etc.)
Possible deployment solutions
- Deploy with the code as part of the code CI (Continous Integration process) using something like migrations or deploy scripts
- Deploy database changes ahead of time in a way that won't break existing code.
- Deploy database changes with their own CI
- Manually deploy database changes
How do you handle your database deployments? Do you use one of the above solutions or something else?
Do you have any tips or tricks for database deployment or handling issues that may arise?