I need to change the data type of the primary key on one of my tables to string from int (I didn't say I WANT to...). The migration generates this bit of code:
AlterColumn("dbo.Venues", "ID", c => c.String(nullable: false, maxLength: 128));
This causes SQL server to complain that the data type must be int, bigint, etc because the column is an identity column. I added the following but it appears to have no effect:
AlterColumn("dbo.Venues", "ID", c => c.Int(identity:false));
Question: How do I get the migration to change the data type from int to string?
The following may be related to my question but not necessarily: The only code generated by the migration is the first AlterColumn shown above. When run as natively generated, the migration caused SQL Server to complain that it could not alter the column because there were dependencies on it. In fact the only dependency is that it is a PK (there are no tables that reference it as a FK). I modified the migration to appear as follows and now I am getting the data type error as indicated above.
DropPrimaryKey("dbo.Venues");
AlterColumn("dbo.Venues", "ID", c => c.Int(identity:false));
AlterColumn("dbo.Venues", "ID", c => c.String(nullable: false, maxLength: 128));
AddPrimaryKey("dbo.Venues", "ID");