Simulate apps database schema update on upgrade

When upgrade, also simulate the database schema update for apps before
doing the actual upgrade.

Please review @icewind1991 @karlitschek @schiesbn