Disable prepared query caching while doing an upgrade

Possible fix for sql errors during upgrade caused by the underlying db schema changing

@karlitschek @bartv2