Fix upgrades

In 11.1.3 we broke upgrades. This PR fixes them again. Specifically, we locked down the db access but didn't adjust for that in the upgrade process. Then even if the db access was fixed, a few of the upgrade commands could still get in a bad state and needed to be adjusted.