Rich Hildebrand
Rich Hildebrand

Reputation: 1875

Entity Framework Migration Adding Column Twice

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.

Upvotes: 3

Views: 1949

Answers (1)

Jimmy_Byrd
Jimmy_Byrd

Reputation: 280

Adding -IgnoreChanges flag to Add-Migration

http://entityframework.codeplex.com/workitem/652

Upvotes: 3

Related Questions