gowebUSA / MSSA-Project

MSSASD7 repository for projects in C# and T-SQL
1 stars 0 forks source link

Error: To change the IDENTITY property of a column, the column needs to be dropped and recreated. #24

Closed gowebUSA closed 4 years ago

gowebUSA commented 4 years ago

Upon Add-Migration, Drop-Database, and Update-Database, the PMC throws an error:

To change the IDENTITY property of a column, the column needs to be dropped and recreated.

This happens when I wanted to create another EF Migration to create a login functionality. After installing Microsoft.AspNetCore.Identity.EntityFrameworkCore NuGet package, I wanted to use the Package Manager Console to Add-Migration, Drop-Database, and Update-Database, but fail because of the Exception error above.

Accepted Criteria: When able to Add-Migration, Drop-Database, and Update-Database without exception error.

gowebUSA commented 4 years ago

I am able to find a solution on https://stackoverflow.com/questions/53408175/change-the-identity-property-of-a-column-the-column-needs-to-be-dropped-and-rec. It's embedded on number 3. Migration/MvcWithReq has double Id alteration. One for AlterColumn and Adds Primary. I tried commenting the Adds Primary but it didn't work. Then I tried commenting AlterColumn Id then it worked.