add database version check to upgrade script