Added database migration handling