The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Schema updates for SQL server

I am curious to find out if anyone has any code available to handle updates on sql server?  I am starting to release an application, and as I've been making changes where there are database level changes, I've been having to hit my client's database directly to make those changes.  I would like to script this out so that the application handles it as part of the startup process.
Richard Bennett Send private email
Saturday, March 22, 2008
 
 
You need to keep track of what 'release' their db schema is and have a set of changes that can be applied to bring it up to date.

This requires re-thinking how you create your SQL, from a static model to a dynamic one. I'd recommend having a 'base' setup and then making all changes after that run through the update process.

If you store the changes based on release you will be able to bring any previous revision up to the current one by applying the changes serially.

Any project that is more than a one-off for personal use should implement something like this. There will be changes and dealing with them in a clean manner from the outset will make maintenance much easier.

.cp
coderpunk Send private email
Sunday, March 23, 2008
 
 
We solve the problem by using a version stamp for the schema.

Then at startup each database is checked against a case statement that applies the schema changes in sequence.
jz Send private email
Sunday, March 23, 2008
 
 
I think that maybe I should have come out and blatently asked... did anyone have any sample source code on possible implementation strategies...

I have been throwing around several ideas including building an abstract class, with implemented classes having the schema update embedded, which could be run out of a controller process of some sort.

I had also thought about the case statements, but c# doesn't care for drop-through model like VB happens to handle quite well.

I'll have to ponder this over the next several days and come up with a decent version of the wheel.

Thanks.
Richard Bennett Send private email
Monday, March 24, 2008
 
 
One of the guys at the office like Dot Net Nuke. One of the features he likes is a scheme for database updates. He's on vacation this week, so I can't get any more details for you.
Peter Send private email
Monday, March 24, 2008
 
 
Several ORMs such as Hibernate can update tables automatically, but they can't handle renames.
AqD Send private email
Sunday, April 13, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz