none
Entity Framework CodeFirst Initial Migration of Existing Database RRS feed

  • Question

  • I have an existing database with data. I want to add code-first, non-automatic data migrations to the project.

    My question is for the initial migration, should the initial migration be a snapshot of the current database schema or should it have empty Up() and Down() methods, essentially starting the migrations with the first schema change, when it occurs?

    I can see the value in having the 1st migration being a snapshot of the existing schema. Just curious.

    This?

    PM> Add-Migration InitialMigration -IgnoreChanges
    

    Or this?

    PM> Add-Migration InitialMigration 
    Friday, February 20, 2015 12:31 PM

Answers

  • First one:

    https://msdn.microsoft.com/en-us/data/dn579398.aspx


    Please mark as answer, if this was it. Visit my SQL Server Compact blog http://erikej.blogspot.com

    • Marked as answer by slinky66 Friday, February 20, 2015 1:35 PM
    Friday, February 20, 2015 12:38 PM

All replies

  • First one:

    https://msdn.microsoft.com/en-us/data/dn579398.aspx


    Please mark as answer, if this was it. Visit my SQL Server Compact blog http://erikej.blogspot.com

    • Marked as answer by slinky66 Friday, February 20, 2015 1:35 PM
    Friday, February 20, 2015 12:38 PM
  • Perfect, thanks. That is what I was looking for
    Friday, February 20, 2015 1:35 PM