move restore database to prepare method