A column rename operation where the only change is the case of the column name i.e. "Text" to "tEXT" generates an invalid migration.
Generated Migration
```
namespace casingMigrationBugRepro.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class b : DbMigration
{
public override void Up()
{
AlterColumn("dbo.Entities", "tITLE", c => c.String());
}
public override void Down()
{
AlterColumn("dbo.Entities", "tITLE", c => c.String());
}
}
}
```
Package Manager commands:
```
PM> Enable-Migrations
Checking if the context targets an existing database...
Code First Migrations enabled for project casingMigrationBugRepro.
PM> add-migration a
Scaffolding migration 'a'.
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration a' again.
PM> update-database
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Applying explicit migrations: [201309122240524_a].
Applying explicit migration: 201309122240524_a.
Running Seed method.
<Uncomment .HasColumnName convention>
PM> add-migration b
Scaffolding migration 'b'.
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration b' again.
PM>
```
Model:
```
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace casingMigrationBugRepro
{
class Program
{
static void Main(string[] args)
{
using (var db = new EntityContext())
{
const int length = 2;
for (int i = 0; i < length; i++)
{
db.Entities.Add(new Entity { Title = "Entity" + (db.Entities.Count() + i), Timestamp = DateTime.Now });
}
db.SaveChanges();
foreach (var entity in db.Entities)
{
Console.WriteLine(entity.Title + ": " + entity.Timestamp);
}
Console.WriteLine("Press any key to exit...");
//Console.ReadKey();
Thread.Sleep(500);
}
}
}
public class EntityContext : DbContext
{
public DbSet<Entity> Entities { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
//modelBuilder.Types().Configure(t => t.Property("Title").HasColumnName("tITLE"));
}
}
public class Entity
{
public int ID { get; set; }
public int key { get; set; }
public string Title { get; set; }
public string Author { get; set; }
public DateTime Timestamp { get; set; }
}
}
```
Generated Migration
```
namespace casingMigrationBugRepro.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class b : DbMigration
{
public override void Up()
{
AlterColumn("dbo.Entities", "tITLE", c => c.String());
}
public override void Down()
{
AlterColumn("dbo.Entities", "tITLE", c => c.String());
}
}
}
```
Package Manager commands:
```
PM> Enable-Migrations
Checking if the context targets an existing database...
Code First Migrations enabled for project casingMigrationBugRepro.
PM> add-migration a
Scaffolding migration 'a'.
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration a' again.
PM> update-database
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Applying explicit migrations: [201309122240524_a].
Applying explicit migration: 201309122240524_a.
Running Seed method.
<Uncomment .HasColumnName convention>
PM> add-migration b
Scaffolding migration 'b'.
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration b' again.
PM>
```
Model:
```
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace casingMigrationBugRepro
{
class Program
{
static void Main(string[] args)
{
using (var db = new EntityContext())
{
const int length = 2;
for (int i = 0; i < length; i++)
{
db.Entities.Add(new Entity { Title = "Entity" + (db.Entities.Count() + i), Timestamp = DateTime.Now });
}
db.SaveChanges();
foreach (var entity in db.Entities)
{
Console.WriteLine(entity.Title + ": " + entity.Timestamp);
}
Console.WriteLine("Press any key to exit...");
//Console.ReadKey();
Thread.Sleep(500);
}
}
}
public class EntityContext : DbContext
{
public DbSet<Entity> Entities { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
//modelBuilder.Types().Configure(t => t.Property("Title").HasColumnName("tITLE"));
}
}
public class Entity
{
public int ID { get; set; }
public int key { get; set; }
public string Title { get; set; }
public string Author { get; set; }
public DateTime Timestamp { get; set; }
}
}
```