Error while doing Migrations EF core 2.0, changing Identity id from string to int
You'll need to update the generated migration to do it in steps. Replace the AlterColumn
call with the following operations:
- Add the new column with a temporary name
- Drop the original column
- Rename the new column using the original columns name
You may also have to rebuild (drop and re-create) all the constraints that reference the column.
It's not trivial, which is why EF currently doesn't handle it. Feature request #329 is about updating EF to handle this automatically.