I'm using Entity Framework 5 in a project, and I've got Migrations enabled.
Here's the scenario:
A new developer (dev1) comes on and builds the project from source. There are existing migrations since previous developers had been working on the project in the past.
When that developer runs the ASP.NET MVC project for the first time, the database builds automatically, and no errors appear.
After that, however, a different developer (dev2) adds a new migration. When Dev1 tries to run Update-Database
, all of the previous migrations are attempted to run. But they have already been applied, since they were part of the initial model as Dev1 saw it. This often results in a schema error since it's trying to apply a schema change that already exists.
So, optimally, it would be great to just "fast forward" the local database to the current migration. But I don't know of a way to do that. Alternatively, is there some other way to initialize the database so that I can apply all the migrations during initialization?