rewrite migration mechanism