使用Entity Framework Core迁移更改主键

问题描述:

我试图通过Entity Framework Core Migrations更改表的主键:

I am trying to Change the Primary key of a table via Entity Framework Core Migrations:

protected override void Up(MigrationBuilder migrationBuilder)
{
        migrationBuilder.DropPrimaryKey(
            name: "PK_Permissions",
            table: "Permissions");
}

当我尝试更新数据库时,出现以下错误消息:

When I try to update the database I get the following error message:

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

如何更新数据库?

我找到了一个解决方案:
这似乎是EF Core 1.1中的错误

I have found a solution: This seems to be a bug in EF Core 1.1

我更改了迁移

有关此信息的更多信息,请参见: https://thisworksonmymachine.com/2017/02/13/ef-core-the-setup-part-4/

More Information about this can be found here: https://thisworksonmymachine.com/2017/02/13/ef-core-the-setup-part-4/