Fix primary key bug in migration