How to: Deploy an Older Version of a Version-controlled Database

If you put a database project and its related unit tests under version control, you can easily retrieve and deploy older versions of that project. You might have to deploy an older version of a database project, for example, to roll back a production database to an older version or to develop a fix for a customer who has an older version of your application. If you are using a version control system such as Visual Studio Team Foundation Server that supports applying a named label to a group of files, you can easily retrieve and deploy an older version of the database. If your version control system does not support labels, you can also retrieve specific versions of individual files, or you might also be able to retrieve the versions of files from a specific date. 

Note

This topic gives the syntax for Team Foundation source control and for Visual SourceSafe. Refer to the documentation for your version control software if you are using some other application.

To retrieve and deploy an older version of your database project

  1. If you are using Team Foundation source control, you can find a labeled version of your project and retrieve the files to your local workspace. If you do not have labels available, you can still get specific versions of files. You can also get the versions of files from a specific date. For more information, see How to: Get the Source for your Team Project.

  2. If you are using Visual SourceSafe, you can find a labeled version of your project and retrieve the files to your local working folder. If you do not have labels available, you can get specific versions of files. For more information, see How to: Get an Item to Your Working Folder.

  3. Generate your database build script for an existing deployment. For more information, see How to: Prepare Database Build Scripts.

  4. Review the database build script. If it is the version that you want, deploy your changes to your isolated development environment. For more information, see How to: Deploy Changes to New or Existing Databases.

  5. Run the unit tests that match the version of your project against your isolated development environment.

  6. If you must modify an older version of a database, you should consider using the branching features that are available in Team Foundation source control. For more information, see Branching and Merging Team Foundation Source Control.

  7. If you want to deploy the database project to a production database, you can hand off the generated build script to the team member who has access to the production server. That team member can review the script and then run it to deploy your changes into production.

See Also

Tasks

How to: Put Database Projects Under Version Control

Concepts

An Overview of Database Creation and Deployment in a Team Environment
An Overview of Database Projects in a Team Environment
Migrating from Another Version Control System to Team Foundation Server and Team Edition for Database Professionals
Terminology Overview of Team Edition for Database Professionals