Migrations - Existing Databases

Sign in to queue


This is the companion screencast to our Code First Migrations with an existing database documentation. The Migrations - Under the Hood screencast is a pre-requisite to this screencast.

In this Entity Framework screencast we'll explore using Code First Migrations with an existing database. We'll look at how to enable migrations for an existing database and then use migrations to propagate changes in your Code First model to the database. We'll also cover how to apply those migrations to other databases, such as your production database during deployment. You'll then see these principals in action with a demo in Visual Studio.



Download this episode

The Discussion

  • User profile image

    Hi, I'm using VS2013 Prof. Edt. Upd. 1 (v12.0.30110.00) following step find this:

    - First, I update with NugGet Packages EF 5 to 6.1 (in .Net 4.0 and 4.5)... also try without this upgrade.

    - In second EF Model Wizard step always show just two options: Generate from datase and empty model.... not 

    - Model is created with different files than your video (.diagram, .tt with clases files related, .designer.cs, etc.)

    - My Package Manager Console Host use Version 2.8.50126.477 not 2.7.41101.371 like yours.

    - When I try to run Enable-Migrations -ContextTypeName MyModelName show me this:

    Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel.

    Please help!

  • User profile image

    Find the problem:

    - First should install Entity Framework 6.1.0 Tools for Visual Studio 2012 & 2013

    - Then update to EF6.1

    - Follow video.


  • User profile image

    When defining models with Entity Framework's Code First and a DbContext class, I find the "View Model" feature of the Entity Framework Power Tools Beta 3 completely indispensable. Without it, I only *think* I know what I've told EF my model should be but I don't really know how Code First will interpret the information I've provided.

    Any plans to get this feature back ? PLEASE!!

Add Your 2 Cents