Answer the question
In order to leave comments, you need to log in
Asp.net core + EFCore + PostgreSQL: Trouble with migration?
There is an old migration that worked great with MSSQL.
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Login = table.Column<string>(nullable: false),
Password = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
null value in column "Id" violates not-null constraint
Failed executing DbCommand (4ms) [Parameters=[@p0='?', @p1='?'], CommandType='Text', CommandTimeout='30']
INSERT INTO "Users" ("Login", "Password")
VALUES (@p0, @p1)
RETURNING "Id";
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question