Found this issue using the same models from: [2338](https://entityframework.codeplex.com/workitem/2338)
Made a slightly easier model for repro seen below.
The issue is that changing the Primary Keys name and making a new migration will create a migration that tries to add a new identity column to the table while it still has an identity column resulting in the error "Multiple identity columns specified for table '<table>'. Only one identity column per table is allowed."
First Migration used this:
```
public class CodeFirstModel
{
public int MyPrimaryKey { get; set; }
}
```
Changed to the below model and made a new migration:
```
public class CodeFirstModel
{
public int Id { get; set; }
}
```
This is the migration that causes the error:
```
public override void Up()
{
DropPrimaryKey("dbo.CodeFirstModels");
AddColumn("dbo.CodeFirstModels", "Id", c => c.Int(nullable: false, identity: true));
AddPrimaryKey("dbo.CodeFirstModels", "Id");
DropColumn("dbo.CodeFirstModels", "MyPrimaryKey");
}
```
Comments: __EF Team Triage:__ In this case you would probably just delete all the scaffolded code and swap it to a rename rather than drop/create. Given this doesn't seem like a very common case and was logged by an EF team member and not a customer we aren't going to fix (at least for now).
Made a slightly easier model for repro seen below.
The issue is that changing the Primary Keys name and making a new migration will create a migration that tries to add a new identity column to the table while it still has an identity column resulting in the error "Multiple identity columns specified for table '<table>'. Only one identity column per table is allowed."
First Migration used this:
```
public class CodeFirstModel
{
public int MyPrimaryKey { get; set; }
}
```
Changed to the below model and made a new migration:
```
public class CodeFirstModel
{
public int Id { get; set; }
}
```
This is the migration that causes the error:
```
public override void Up()
{
DropPrimaryKey("dbo.CodeFirstModels");
AddColumn("dbo.CodeFirstModels", "Id", c => c.Int(nullable: false, identity: true));
AddPrimaryKey("dbo.CodeFirstModels", "Id");
DropColumn("dbo.CodeFirstModels", "MyPrimaryKey");
}
```
Comments: __EF Team Triage:__ In this case you would probably just delete all the scaffolded code and swap it to a rename rather than drop/create. Given this doesn't seem like a very common case and was logged by an EF team member and not a customer we aren't going to fix (at least for now).