实体框架迁移添加列两次 [英] Entity Framework Migration Adding Column Twice
问题描述
当我尝试运行它时,这是详细的结果包管理器:
应用基于代码的迁移:201211261626569_AddActiveFlagForProjects。
ALTER TABLE [Projects] ADD [Active] [bit] NOT NULL DEFAULT 1
[插入迁移历史记录记录]
应用自动迁移:201211261901371_AutomaticMigration。
ALTER TABLE [Projects] ADD [Active] [bit] NOT NULL DEFAULT 0
为什么EF试图改变项目表两次?
我正在使用Entity Framework 5.0和SQL CE 4.0。
将-IgnoreChanges标记添加到-Migration
http:// e ntityframework.codeplex.com/workitem/652
I'm running Entity Freamework Code First Migrations. When trying to run the application I get the error: A column ID occurred more than once in the specification. I have AutomaticMigrationsEnabled set to true in the configuration because when I run the project, I want the migrations to run automatically.
This is the verbose results when I tried running it through the package manager:
Applying code-based migration: 201211261626569_AddActiveFlagForProjects.
ALTER TABLE [Projects] ADD [Active] [bit] NOT NULL DEFAULT 1
[Inserting migration history record] Applying automatic migration: 201211261901371_AutomaticMigration.
ALTER TABLE [Projects] ADD [Active] [bit] NOT NULL DEFAULT 0
Why is EF trying to alter the projects table twice?
I'm using Entity Framework 5.0 and SQL CE 4.0.
Adding -IgnoreChanges flag to Add-Migration
http://entityframework.codeplex.com/workitem/652
这篇关于实体框架迁移添加列两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!