Optimize migrations