I got the default ASP.NET MVC 4 template successfully running with EF 5.0 Code First Migrations. However, when I update a model property name, the corresponding table column dat
Adding to Josh Gallagher's answer:
In some places the sp_RENAME syntax is described like this:
sp_RENAME 'TableName.[OldColumnName]' , '[NewColumnName]', 'COLUMN'
However, that will actually include the brackets in the new column name.
DbMigration's RenameColumn() method will probably do the same, so avoid using brackets when specifying the new column name.
Also, the auto-generated commands in Up() & Down() include DropPrimaryKey() and AddPrimaryKey() if the column being renamed is part of the primary key. These are not needed when using RenameColumn(). The underlying sp_RENAME automatically updates the primary key if needed.