keeping database in sync ef core

entity-framework-core entity-framework-core-migrations


I have read multiple posts about this but do not have a clear answer yet. We are transitioning to EF Core 2.0 company-wide, one project at a time.

The challenge is this:

  1. A new project starts and a database is created using code first, migrations etc.
  2. another programmer needs to create a project targeting the same database.
  3. This programmer can use Scaffold-DbContext and generate current models.
  4. However, a new column is needed and this second programmer adds it. do we best update the other projects? Is there something that checks and syncs or shows what is out of sync between your model and a database? Meaning check the database for changes...not the model.

We don't mind buying a tool if that is the best solution.

6/7/2018 1:09:43 PM

Accepted Answer

The solution we have been using, very successfully is the Database project in Visual Studio.

Using that each developer has the project in their solution, changes are made against it locally. Then we can do a "Schema Compare" inside of VS.

We have been using this successfully for 4 of us the past three weeks extensively with almost no issues.

This has even worked for keeping versions and changes to our stored procedures current. It works well with VSTS also.

Here are some of the posts I read that helped me understand it:

..and this forum had a lot of relevant questions/answers:

6/30/2018 2:16:32 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow