Add pre-migrate hook

Also, rename hook variables to better describe their purpose.