Repro:
Create simple model:
```
public class Foo
{
public int Id { get; set;}
public string Name { get; set; }
}
public class MyContext : DbContext
{
public DbSet<Foo> Foos { get; set; }
}
```
Enable-Migrations
Add-Migration Mig1
Update-Database
Remove identity from the key column:
```
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Foo>().Property(p => p.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
}
```
Add-Migration Mig2
Update-Database
Result is that we silently succeed, but nothing happens on the database (i.e. Id is still Identity). If one tries to insert rows afterwards, we throw exception. We should either properly migrate table to non-identity or throw error that we don't support this change.
Same thing goes for migration the other way around.
Comments: Duplicate of https://entityframework.codeplex.com/workitem/509
Create simple model:
```
public class Foo
{
public int Id { get; set;}
public string Name { get; set; }
}
public class MyContext : DbContext
{
public DbSet<Foo> Foos { get; set; }
}
```
Enable-Migrations
Add-Migration Mig1
Update-Database
Remove identity from the key column:
```
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Foo>().Property(p => p.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
}
```
Add-Migration Mig2
Update-Database
Result is that we silently succeed, but nothing happens on the database (i.e. Id is still Identity). If one tries to insert rows afterwards, we throw exception. We should either properly migrate table to non-identity or throw error that we don't support this change.
Same thing goes for migration the other way around.
Comments: Duplicate of https://entityframework.codeplex.com/workitem/509