EF6으로 업데이트했으며 재미 있지 않았습니다. 두 필드를 nullable로 변경하는 새로운 마이그레이션을 만들었습니다.EF 6.0 마이그레이션 : MigrationHistory의 ContextKey가 null입니다.
public partial class AllowNullableFieldsForImage : DbMigration
{
public override void Up()
{
AlterColumn("dbo.Scabs", "image_height", c => c.Int());
AlterColumn("dbo.Scabs", "image_width", c => c.Int());
}
public override void Down()
{
AlterColumn("dbo.Scabs", "image_width", c => c.Int(nullable: false));
AlterColumn("dbo.Scabs", "image_height", c => c.Int(nullable: false));
}
}
내가 update-database
를 실행하면 나는 다음과 같은 오류 얻을 :이 왜 ... 내가 몇 MigrationHistory의 새로운 ContextKey 필드를 언급하는 기사하지만 내 질문에 대답 아무것도를 발견했습니다
Cannot insert the value NULL into column 'ContextKey', table 'ScabsContext.dbo.__MigrationHistory'; column does not allow nulls. INSERT fails. The statement has been terminated.
을 필드가 null입니까? 방법이 있습니까 (및해야합니까) ContextKey
에 대한 값을 지정합니까? 나는 그것이 자동적으로하게되었다라고 생각했다?
감사합니다. – tkt986