Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database / SQL-Server

Automated Database Change Management Process

1.67/5 (6 votes)
4 May 2007CPOL1 min read 1   253  
The uploaded .NET solution includes the implementation of a database change management process that, if applied correctly, can dramatically reduce the time you spend synchronizing various versions of application databases in development, staging, and production environments.

Introduction

If you've arrived at this page, you've most likely come by way of the 2007 Austin .NET User Group (ADNUG) Code Camp. The attached software contains the software elements of a comprehensive Database Change Management process. It simplifies the process of keeping multiple database environments in synch (i.e., development, staging, and production). The process works by allowing developers to commit SQL scripts to the source code repository alongside their other code files. A NAnt build script is also included which will actually execute these scripts in order against a specified database. In addition to storing SQL schema change scripts, the Northwind.Database project in the solution stores database creation scripts. As a result, the included NAnt script can be used to easily create a new database instance or update any existing instance managed by the process.

Using the code

To begin using the attached solution, you must have either SQL Server 2005 or SQL Server 2005 Express. Simply follow these steps to set up the solution and watch the database change management process in action:

  1. Open solution trunk\source\Northwind.sln.
  2. Build the solution.
  3. Set Northwind.DatabaseUpdater as the Startup project.
  4. Run the solution (which will execute Northwind.DatabaseUpdater).
  5. Make sure the following five settings are selected on the form that appears, and click the Update button.
    • Action = Update
    • Type = SqlServer200x
    • Server = SQL Server 2005 instance name (.\SQLExpress by default)
    • Database = Northwind
    • Username and Password = Leave blank
    • SSPI (integrated security) = Checked

Note: if you change the server name to something other than .SQLExpress, you'll need to update TestingConnectionStringProvider accordingly.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)