If a migration is absolutely necessary for your website, then you should do everything that is possible to reduce the ranking drops your site is about to experience. There really is no way to make sure that your website stays exactly where it is, it just all depends on what exactly you are changing on