How can I update the schema of a production database in a VWD solution without overwriting data?

StackOverflow https://stackoverflow.com/questions/5410063

Question

I have a data driven website (SQL Express auto-attached mdf file) that was built as a local site in Visual Web Developer 2010 Express, then deployed to a production server. The site is stored locally and checked into SVN for version control. Application updates are made to the local copy (using the built in development web server) then copied to the production server using the Copy Website function.

The problem I'm having is that any changes made to the database schema can be tested locally, however, there does not seem to be any way to copy these changes to the production database without overwriting the entire file including the production data.

I suppose I could connect to the production database directly and make the necessary changes by hand, however, this leaves a lot of room for error, especially in cases where a significant number of changes have been made. I do not see any way in VWD to script the changes either.

So my question is: What is the best way to handle these database schema updates in VWD 2010 Express?

Searching Stack Overflow and Google has been unfruitful, so any help is greatly appreciated!

Cheers,
JE

Was it helpful?

Solution

I believe you are referring to what are known as SQL Express User Instances. From this excellent article on SQL Express User Instances, a tool called SSEUtil can be used to execute commands against the local user instance. Note that I said local.

Unfortunately this isn't a direct answer to your question of how to best handle schema updates in VWD 2010. The reason for this is because there isn't any way to do this. User Instances are local (connections use named pipes) and you will need to do the updates within the production environment. Using SSEUtil is better than installing VWD 2010 on the server or writing your own code to do the updates manually.

Really once a database is released into production, update scripts are the only way things get updated. Obviously it's rare that you can do a backup of your dev database and restore to production. There are professional grade products that can simplify this process but really update scripts are where you start from.

One suggestion: I'd move away from User Instanced SQL Express to at least a regular SQL Express instance if you can.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top