4

I've used mvcScaffolding and mvc3 to generate my tables in a sql2008 database. some data has been added.

I've changed a single model and wish to alter the underlying table.

  1. is there a way to auto-update a single table to keep it in sync with the model?
  2. after adding a new model how can the database table be created without recreating the database
1
  • What exactly are you using to generate the initial schema for the database? EF Code-First? NHibernate? Commented Jan 25, 2011 at 23:30

2 Answers 2

1

You're looking for something like Rails' migrations. There are a couple .NET migrations providers floating around, but the basic setup you've described doesn't support alterations to the schema without recreating the database (at least in my experience).

Sign up to request clarification or add additional context in comments.

2 Comments

I should note my answer is assuming you're using EF (Code First) since you mentioned mvcscaffolding.
you are correct, what I'm looking for is not in the scaffolding yet. I need to somehow turn it off; then i can supply my own database updater.
1

have you tried treating your database an an existing one as described in this example by Scott Gu?

http://weblogs.asp.net/scottgu/archive/2010/08/03/using-ef-code-first-with-an-existing-database.aspx

Hopefully thias way you will not have to re-create your db everytime a change is required...

Regards

Paul

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.