I've faced this problem regularly for the last few years, and I'm wondering if there is a better approach. Currently, when doing an upgrade, I will upgrade a branch of our repository, apply all the updates and if there are any adjustments to be made, I'll commit those to our upgrade branch.
Because upgrades make changes to both the codebase and the database schema / data, I can't just take my upgraded codebase and migrate it to production. Instead, I have to repeat the process on a production system so that the production database can be updated. This can be onerous when, for example, upgrading someone from 7.7.0 up to 7.9.3 with several steps. Once we're upgraded to the target version, all the working code is brought in from github. This is usually done at night or on the weekends, as to not impact production.
Is there a way to apply the database changes independently of the upgrade? Thanks.