Dev/QA/Similar: Either containerize and back to persistent volume, or use a managed DB service such as RDS or Cloud SQL and create a schema per environment. Include a deployment pipeline argument to reset to known state. CI pipeline can be tuned to handling dynamic environments in either case.
Stage/Prod: Use managed DB service such as RDS or Cloud SQL.
The time and cost to automate a DB upgrade with every edge case considered is huge. Rarely makes sense for small/medium business.
The reasons I've seen for doing so are usually penny-wise, pound-foolish. Penny-wise in saving a few dollars (conceptually) on a spreadsheet for per-env/per-cycle, while neglecting the long-tail consequence of your labor factor just growing, potentially forever, without regard for total cost of ownership.
Sorry didn't mean to rant. Hope this helps.