Rubia Gardini
Rubia Gardini

Reputation: 815

Entity Framework + SQL Azure: best practices for database changes

I'm designing a database that it's not totally defined yet, and as the project goes, it won't be defined very soon. However, the project will be online very soon, and database will be changing online. So, I need be prepared to database changes. Add tables, add columns, whatever.

I'm not used to Entity Framework, but I already tried all approaches (code first, database and model first) and I like most the Model First approach, cuz I'm not used to relations yet and Model First do that for me.

The problem is: my server is Windows Azure, and I have to script SQL Azure (I still wonder why Microsoft changed that.........)

So, my question is: - What should I do, step-by-step, to update my Model and update my database when Model changes?

Upvotes: 0

Views: 441

Answers (1)

Craig
Craig

Reputation: 36816

What I do is

  1. Have a database project in VS2010 so I can create a fresh database with latest schema.
  2. Backup the Azure database locally with RedGate SQL Azure Backup.
  3. Use RedGate Compare to compare the databases and create a diff script.
  4. Run the script to make sure it works locally on my backup from step 2.
  5. Run the script on Azure.

Upvotes: 2

Related Questions