Fixed upgrade DB detection