You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately this is part of a much larger project. However I will provide anything I can.
The issue
Forgive me if this shouldn't be logged here or I have done something stupid, publishing migrations doesn't seem to apply the Identity flag to a column but only on Sql Server. I'm using OpenIddict with Identity to generate the base schema for the database. A table AspNetUserClaims has an Identity column that is shown with the correct annotation (I believe) in the migration script:
migrationBuilder.CreateTable(name:"AspNetUserClaims",columns: table =>new{Id=table.Column<int>(nullable:false).Annotation("Autoincrement",true),ClaimType=table.Column<string>(nullable:true),ClaimValue=table.Column<string>(nullable:true),UserId=table.Column<string>(nullable:false)},constraints: table =>{table.PrimaryKey("PK_AspNetUserClaims", x =>x.Id);table.ForeignKey(name:"FK_AspNetUserClaims_AspNetUsers_UserId",column: x =>x.UserId,principalTable:"AspNetUsers",principalColumn:"Id",onDelete:ReferentialAction.Cascade);});
My startup.cs is switching between a Dev and Prod environment, Dev is using Sqlite and Prod is using a DB on a Sql Server instance. When I apply this migration to the database using dotnet ef database update or by generating a script directly for each environment, using:
dotnet ef migrations script -e Development -o Sqlite.sql
dotnet ef migrations script -e Production -o SqlServer.sql
I have little knowledge on Sqlite but I see the AUTOINCREMENT attribute is there, however the Sql Server (Production) script/update gives the following:
There is no IDENTITY modifier on the [Id] field, nor are there any constraints defined elsewhere in the script.
Exception message:
Generic exception about attempting to place a NULL value in the AspNetUserClaims [ID] field.
Stack trace:
Further technical details
EF Core version: (found in project.json or packages.config)
Microsoft.EntityFrameworkCore.Sqlite: 1.0.0
Microsoft.EntityFrameworkCore.SqlServer: "1.0.0
Microsoft.EntityFrameworkCore.Tools: 1.0.0-preview2-final
Operating system:
Windows Server 2008 R2
Visual Studio version: (e.g. VS 2013 or n/a)
Visual Studio 2015 Professional
Other details about my project setup:
None of relevance as far as I'm aware.
The text was updated successfully, but these errors were encountered:
Migrations are currently only generated based on the active provider (SQLite). You'll need to compensate for any additional providers you intend to run the migrations on. After the autoincrement annotation, add the following.
Steps to reproduce
Unfortunately this is part of a much larger project. However I will provide anything I can.
The issue
Forgive me if this shouldn't be logged here or I have done something stupid, publishing migrations doesn't seem to apply the Identity flag to a column but only on Sql Server. I'm using OpenIddict with Identity to generate the base schema for the database. A table AspNetUserClaims has an Identity column that is shown with the correct annotation (I believe) in the migration script:
My startup.cs is switching between a Dev and Prod environment, Dev is using Sqlite and Prod is using a DB on a Sql Server instance. When I apply this migration to the database using
dotnet ef database update
or by generating a script directly for each environment, using:Sqlite (Dev) gives:
I have little knowledge on Sqlite but I see the AUTOINCREMENT attribute is there, however the Sql Server (Production) script/update gives the following:
There is no IDENTITY modifier on the [Id] field, nor are there any constraints defined elsewhere in the script.
Exception message:
Further technical details
EF Core version: (found in project.json or packages.config)
Microsoft.EntityFrameworkCore.Sqlite: 1.0.0
Microsoft.EntityFrameworkCore.SqlServer: "1.0.0
Microsoft.EntityFrameworkCore.Tools: 1.0.0-preview2-final
Operating system:
Windows Server 2008 R2
Visual Studio version: (e.g. VS 2013 or n/a)
Visual Studio 2015 Professional
Other details about my project setup:
None of relevance as far as I'm aware.
The text was updated successfully, but these errors were encountered: