Change reference by `hash` to `email.id`
Add migration for last two commits