Move migration stuff into common.