SQL Source Control 7

Update to a revision from source control

You can update your database to a specific version from source control using SQL Compare or SQL Data Compare.

When you do this, SQL Source Control overwrites the current database schema (and any source-controlled data) with the version you selected.

Updating to a specific version from the History dialog box

When you update to a version form the History dialog box, SQL Compare or SQL Data Compare is used to update the target database.

To update to a specific version:

  1. In the Object Explorer, right-click the database or object and click View history:

    The History dialog box opens:
     

  2. Select the version you want to update to.
  3. If you want to update the schema, click Update to this version with SQL Compare.
    If you want to update the data, click Update to this version with SQL Data Compare.
  4. A SQL Compare or Data Compare project launches with the version you selected as the source, and the database as the target:

  5. To update the database, run the comparison, make sure all objects you want to update are selected, and run the deployment wizard.

For more information about comparing databases with SQL Compare, see Worked example - comparing and deploying two databases in the SQL Compare documentation.

Updating to a specific version manually

You can update to a specific version using your source control system and SQL Compare.

Update to a specific version with Git

To update to a specific version with Git:

  1. Using another Git tool, check out the revision you want.
  2. Open SQL Compare.
  3. Under Source: 
    1. Select Source Control and then select Scripts folder.
    2. In the Scripts Folder box, select the folder, or clickto browse to the folder.
  4. Under Target:
    1. in the Server box, select Database.
    2. Select the authentication method.
    3. In the Database box, type or select the database.
  5. Click Compare Now.
    The database is updated to the version you selected.

Note that this will appear as a change to the database on the commit tab. 

Update to a specific revision with TortoiseSVN

To do this, create a local copy of the revision and deploy the database using SQL Compare:

  1. Check out the latest version to a new folder.
  2. Right-click the folder, and from the TortoiseSVN menu, select Show log.
    The Log Messages dialog box is displayed.
  3. Select the revision you want to get, right-click, and click Revert to this revision.
  4. A confirmation dialog box is displayed. Click Yes.
    The folder of scripts is updated to the revision you selected.
  5. Using SQL Compare, set the scripts folder as the source for a comparison, and the database as the target, then compare and deploy.

    The database is updated to the revision you selected.

Example: update to a specific changeset with TFS

To do this, update the TFS local copy to a specific changeset, and deploy the database using SQL Compare:

  1. In Visual Studio, in the Source Control Explorer tab, select the database, right-click, and click Get Specific Version.
    The Get dialog box is displayed.
  2. Under Version, in Type select Changeset.
  3. Type the changeset number, or click the browse button to display the Find Changesets dialog box, and select the changeset you want.
  4. Click Get.
    The local scripts folder has been updated to the changeset you selected.
  5. Using SQL Compare, set the local scripts folder as the source for a comparison, and the database as the target, then compare and deploy.

    The database is updated to the revision you selected.


Didn't find what you were looking for?