EF Core creating table again in second migration

31 Views Asked by At

So I am trying to make a new migration. I have a init migration, and I am making a second migration.

However when I create that second migration, it keeps trying to create a new table even though it already exists. It is literally the same code. The only difference is the fact that in the second migration, it is asigning the nvarchar(n) as 450 isntread of 25.

Even still that doesnt explain why it is making an entirely new table, and not just adjusting the size of the varchar.

The code is below.

 migrationBuilder.CreateTable(
 name: "TableName",
 columns: table => new
 {
     pk_value= table.Column<string>(type: "nvarchar(25)", nullable: false),
     value = table.Column<int>(type: "int", nullable: true)
 },
 constraints: table =>
 {
     table.PrimaryKey("PK_TableName", x => x.Code);
 });
0

There are 0 best solutions below