An Overview of Database Projects in a Team Environment

When you work in a team environment, it is important to control when changes reach other team members. For teams that are developing applications that have one or more databases, you can increase that control by creating a database project and putting it under version control software, such as Visual SourceSafe or Team Foundation source control. You can put the whole database project and all the items that it contains under version control. These items include data generation plans, .sql files that define the objects that make up the database schema, and scripts that are part of the database project. In addition, any miscellaneous files such as documents, diagrams, or html files that support your project can be added to your project and placed under version control.

Putting a Database Under Version Control

When you put a project for a new or an existing database under version control, you follow many of the same steps for putting any other type of project under version control.

  1. Create a database project.

  2. For an existing database, import the schema from the deployed database into the database project.

  3. For a new database, you can create the database objects with which you initially want to populate the database. You can defer this step until after you check in the project and all its items.

  4. Add the database project to version control.

  5. Check in the project and all its items.

After you check in the project and its items, your team can begin to work with the database. For more information, see How to: Put Database Projects Under Version Control.

Typical Version-Control Features

Database projects support the following features of version control:

  • You can get the most recent version of one or more files to synchronize the client workspace with the most recent version that was checked in.

  • You can open the database project from the source control browser (for example, the Visual SourceSafe Explorer or the Team Foundation Server Source Control Explorer).

  • Changes that are made to the objects in the version control system are reflected as if the changes were made directly to the project.

  • You can rename objects under version control from the version control system, from Solution Explorer, or by using database refactoring. You can specify whether you will be prompted to check out the files or the files will be checked out automatically.

  • You can check out objects at varying levels of granularity, from an individual database object (such as a trigger, a table, or a stored procedure) to the whole solution.

  • Solution Explorer indicates which files are under version control, which files are checked in, which files are checked out, and so on by changing the icon that appears next to the file.

  • You can view the history of changes for all files that make up the database project.

  • You can control the behavior of version control actions through your settings in Tools, Options. For example, you can specify whether objects should be checked out automatically when you modify them or whether you should be prompted for check out. Each user has one set of version control settings.

For more information, see the documentation for your version control system.

Differences from Version Control for Software Projects

There are only a few differences between database projects that are under version control and software projects that are under version control. For database projects, some nodes in the project hierarchy in Solution Explorer are not stored in separate files (such as columns within a table). For those nodes, the version control operations apply to the containing object, instead than to the object that does not have a corresponding file representation.

See Also

Tasks

How to: Put Database Projects Under Version Control
How to: Deploy an Older Version of a Version-controlled Database
Walkthrough: Put an Existing Database under Version Control
Walkthrough: Deploy Changes to an Existing Version-controlled Database

Concepts

Team Foundation Source Control
Terminology Overview of Team Edition for Database Professionals

Other Resources

Getting Started with Visual SourceSafe