2

I have several installations of my Linq-to-Sql app running in the field. Now I've created a new version, which adds a new column to a certain table. I've added this column in the dbml file. But when updating the installation, I want to preserve the existing database. How to handle this? Linq-to-SQL doesn't seem to like this inconsistency.

Is there an easy way to update the existing database using my new dbml file?

1
  • As far as I know this only goes one way (SQL -> LINQ), will be interesting to see if this gets an answer. Commented Jan 27, 2010 at 9:25

1 Answer 1

1

You need to manage your database schema explicitly - that is to say that you should have creation and update of the database schema scripted so that its repeatable. For the scenario your describing I think that your application should (ideally) create and then update the database schema as required. The initial work to set this up isn't too hard and once you have the system in place making schema changes is straightforward

I wrote this up (in terms of what has worked for me for a lot of years now) at some length here:

How to create "embedded" SQL 2008 database file if it doesn't exist?

Which probably ought to be modified to take advantage of this which talks about using database extended properties:

SQL Server Database schema versioning and update

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

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.