C
C#3y ago
BokoGanga

EF Core migrations script failing but not enough details!

Hey devs, I am trying to run a migrations script to generate a sql file for the migration but I am running into an error "cant change identity property of a column...". But there is no information regarding which migration exactly is causing this error, or table or anything. Just the error and thats it. I would like to investigate this more but I have no leads. If anyone has any idea how to expose extra details for this exception, I would be really grateful. Here is the command line i'm using:
dotnet ef migrations script --configuration Release -p .\folder\projectName.Api.csproj --no-build --context ProjectNameDbContext --idempotent -o D:\migrations\migration.sql
dotnet ef migrations script --configuration Release -p .\folder\projectName.Api.csproj --no-build --context ProjectNameDbContext --idempotent -o D:\migrations\migration.sql
6 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
BokoGanga
BokoGangaOP3y ago
Didn't add any extra info. Looks like there is no such thing. Thanks a lot
Tvde1
Tvde13y ago
you have an IdentityUser<...> right? you changed the generic parameter of it, which changes the primary key of it and that's not possible your best bet is just to remove all migrations and create a new first initial migration
BokoGanga
BokoGangaOP3y ago
No, I'm not user Identity. I think I know the migration thats causing the issue and the entity too. I commented the migration's code and still the exception is thrown
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Tvde1
Tvde13y ago
Don't comment out migration code :) But yeah drop all migrations and create a new one
Want results from more Discord servers?
Add your server