Change the migration to use reference and add index