How to: Put Database Projects Under Version Control

To manage changes to your database, you create an associated database project and put it under version control. You or members of your team make all changes to the database project and then build and deploy it to a new or existing instance of the active database.

You can put your database project under version control either when you create it or later (for example, after you have created an initial design for the schema).

To create a database project and put it under version control

  1. On the File menu, point to New, and click Project.

    The New Project dialog box appears.

  2. In Project Types, expand the Database Projects node, and click Microsoft SQL Server.

  3. In Templates, click the project template that corresponds to the database version that you want to create (Microsoft SQL Server 2000 or SQL Server 2005).

  4. In Name, type the name that you want to give the project.

  5. In Location, type the full path of the location where you want to create the project. You can also click Browse to search for the path.

  6. Select the Add to Source Control check box, and click OK.

    The database project is created with the parameters that you specified.

  7. When prompted, follow the instructions for your version control software to finish putting the project under version control.

    The database project is put under version control, but it might not be checked in yet, depending on which version control system you are using. You can make additional changes before you check it in (for example, adding tables and other database objects). For information about how to check in your changes, see the last procedure in this topic.

To put a solution that contains a database project under version control

  1. On the File menu, point to Source Control, and click Add Solution to Source Control.

    A dialog box that is specific to your version control software appears. For example, if you are using Visual Studio Team Foundation Server, the Add Solution SolutionName to Source Control dialog box appears.

  2. Follow the instructions for your version control software to complete the process of putting your database project under version control.

    The database project is put under version control, but it may not be checked in yet, depending on which version control system you are using. You can make additional changes before you check it in (for example, adding tables and other database objects). For information about how to check in your changes, see the last procedure in this topic.

To put a database project under version control

  1. In Solution Explorer, click the database project that you want to put under version control.

  2. On the File menu, point to Source Control, and click Add Selected Projects to Source Control.

    A dialog box that is specific to your version control software appears. For example, if you are using Visual Studio Team Foundation Server, the Add Solution SolutionName to Source Control dialog box appears.

  3. Follow the instructions for your version control software to complete the process of adding your database project to version control.

    The database project is added to version control, but it may not be checked in yet, depending on which version control system you are using. You can make additional changes before you check it in (for example, adding tables and other database objects). For information about how to check in your changes, see the last procedure in this topic.

Checking in Changes

When you first put a database project under version control, all files are checked out by default. To make the project available to other team members, you must check in the project and its project items.

To check in your database project and its project items

  1. On the File menu, point to Source Control, and click Check In.

    A dialog box that is specific to your version control software appears. For example, if you are using Visual Studio Team Foundation Server, the Check In - Source Files - Workspace: WorkspaceName dialog box appears.

  2. Follow the instructions for your version control software to complete the process of checking in your database project and its project items.

Security

Your team administrator might need to grant you permissions to access your version control repository.

See Also

Tasks

Walkthrough: Create and Deploy a New Version-controlled Database
Walkthrough: Put an Existing Database under Version Control
How to: Add Files to a Database
How to: Check In Changes to an Item
How to: Add a Project or Solution to Source Control
How to: Check In Pending Changes

Concepts

An Overview of Database Projects in a Team Environment
Terminology Overview of Team Edition for Database Professionals