Alex Rivera | Logout

What are the best practices for database scripts under code control

Asked 2008-12-04T13:42:21.310
25

We are currently reviewing how we store our database scripts (tables, procs, functions, views, data fixes) in subversion and I was wondering if there is any consensus as to what is the best approach?

Some of the factors we'd need to consider include:

  • Should we checkin 'Create' scripts or checkin incremental changes with 'Alter' scripts
  • How do we keep track of the state of the database for a given release
  • It should be easy to build a database from scratch for any given release version
  • Should a table exist in the database listing the scripts that have run against it, or the version of the database etc.

Obviously it's a pretty open ended question, so I'm keen to hear what people's experience has taught them.

Edit
Report

1 Answer

0

Our company checks them in simply because someone decided to put it in some SOX document that we do. It makes no sense to me at all, except possible as a reference document. I can't see a time we'd pull them out and try and use them again, and if we did we'd have to know which one ran first and which one to run after which. Backing up the database is much more important then keeping the Alter scripts.

answered 2008-12-04T14:00:28.593

Your Answer