Entity Framework is nice to rapid prototype and work with databases. The addition to have migrations of different database versions is a quite usefull extension if you work with already deployed databases that need to be changed without loss of data.
Well, i just added a column to an existing Table in my Database. The added Property
public virtual int ExtryLockingPeriod { get; set; }
in my Entity results in the migration
public override void Up()
{
AddColumn("dbo.AssetSettings", "ExtryLockingPeriod", c => c.Int(nullable: false));
}
And now the trick to tell the Entity Framework the proper Default Value:
public override void Up()
{
AddColumn("dbo.AssetSettings", "ExtryLockingPeriod", c => c.Int(nullable: false, defaultValue: 10));
}
Simple is that!