havardhu
havardhu

Reputation: 3616

Synchronizing EF Code First to SQL Azure

I am trying to find the best way to synchronize/migrate EF Code First databases from localhost to SQL Azure without using EFCF Migrations. I know that I could use this approach, but I want to look at different, less automagic options.

The following process, or variations of such, is the one I'd like to follow:

  1. Develop locally, letting EFCF build the databse on localhost
  2. Synchronize the local database with the stage database on SQL Azure using some tool
  3. Run tests in the staging environment
  4. Synchronze/migrate the database (local or stage) to the production database on SQL Azure

Using MySQL, this is a breeze. The MySQL Workbench can synchronize a schema model to the database in question, plain and simple. In this case, I don't have a schema model per se, but the database on localhost generated by EFCF could be concidered the schema.

Which tools are available to perform this task? Is it possible to do this using SSMS?

Update: How I did it: After the tip from Craig to use a Visual Studio 2012 Database Project, I did the following:

  1. Created an empty VS 2012 database project and set its target platform to SQL Azure
  2. Did a new schema compare, source database = local db and target = database project
  3. Updated the target. This brought the database project up to speed
  4. Did a new compare, source= database project and target = SQL Azure stage db
  5. Updated the target. This brought the SQL Azure stage db up to speed

This was exactly what I was looking for

Upvotes: 4

Views: 677

Answers (2)

Craig
Craig

Reputation: 36856

The Visual Studio 2012 database project can do it, I do it all the time.

Upvotes: 3

Tom Halladay
Tom Halladay

Reputation: 5761

It's not free, but Red-Gate's SQL Compare would handle the schema replication

Upvotes: 1

Related Questions