Will EF Code First Migrations work well with distributed version contol system (like git or mercurial)? RRS feed

  • Question

  • Actually the question is not mine, I found it at


    but I too am very curious about its answer and on stack overflow noone seems to have expertise with the issue.

    Basically Chris asks if it is possible to use code first migrations in case developers are working decentralized with their own test-/dev-databases.

    So lets assume, some of my CoWorkers work on their part of the project and add migrations to add new tables or to simply modify tables. But before they commit and push their changes to our DVCS server, I as well created a few migrations and pushed them to the server. 

    So what I wonder is: does EF CF Migrations detect changes in the migration chain?

    And if yes, how exactly would it behave if it detected changes that were created before my latest migrations but not yet injected into my local database?

    Would it roll back known (as in reflected into the databases migration table) migrations to the last commonly known migration and then remigrate (update-database) from that point on ?

    Or would we have to merge those changes into the database manually?

    Sunday, September 23, 2012 10:47 PM

All replies

  • EF will provide a version for every migrations, when you do migrations, if EF detects that the original version of migration isn't the same one, it will stop.

    Go go Doraemon!

    Tuesday, September 25, 2012 2:02 AM