Operations with source control

Schema Compare allows you to select an SQL source control version either as a target or as a source as well as to create a new SQL source control version.

This topic describes the following features:

Add a new SQL source control version

1. Under Source or Target select Source Control.

2. In the Repository box, click < Manage >.

Create source control

3. In the Repository Manager window that appears, click the New button to add a new repository.

Repository manager

4. In the Source Control Repository Properties window, select a type of source control system and follow the instructions.

Source control properties

5. Click OK.

Alternatively, click + or next to the Repository box.

Select a source control version

1. Under Source or Target select Source Control.

2. In the drop-down list of the Repository box, select a repository.

3. In the Revision box, select a specified revision from the source control history or select the latest revision.

Select version

4. If you select a specified revision, the Revision history window opens. In the window, you can see the list of the source-control revisions of your database.

Select revision

5. Select a required revision and view all code changes made in the commit, a commit message, and the type of operation that took place.

Handle source control issues

  • When source control version is a target, Schema Compare creates a synchronization script that can be saved to a file. Source control versions cannot be modified directly.

  • When a source control version is a source, a synchronization script can be executed directly against the target database.

  • Schema Compare doesn’t allow Working Folders comparison. Try using Scripts Folders instead.

Add a TFVC repository

1. Select Team Foundation Version Control (TFVC) from the Source Control system drop-down list box.

Add TFVC Repository

2. In Source Control settings, specify:

2.1. Server URL for the TFVC server.

2.2. Authentication type from the drop-down list.

TFVC Authentication Types

Note

Azure DevOps Server refers to an on-premises server whereas Azure DevOps indicates a set of cloud-hosted DevOps services.

  • Base is a basic web authentication type. If you select this type, you will need to enter your Username and Password. Remember to enable the appropriate option in either cloud or server.

Note

The Base authentication type is not recommended due to its low security level.

  • Token is an OAuth authentication type. If you select this type, you will need to obtain an authorization token in the security settings of your server.

  • Windows is a windows-based authentication type used for an on-premises server. If you select this type, your current Windows user account will be used.

  • Web is an authentication type used for a cloud service. If you select this type, you will be prompted to enter a Username and Password for your web account.

Note

To get proper settings for Server URL, Username and Password, contact your system administrator.

2.3. Database folder in TFVC that contains SQL scripts for your project.

2.4. Repository name.

Click Test to check the connection.

3. Click OK to close the Source Control Repository Properties dialog box.

Add a Subversion repository

1. Select Subversion (SVN) from the Source Control system drop-down list box.

Add SVN Repository

2. In Source control settings, specify:

  • Server URL, Username, and Password for the SVN server.

Note

To get proper settings for Server URL, Username and Password, contact your system administrator.

  • Database folder in SVN that contains SQL scripts for your project.
  • Repository name.

Click Test to check the connection.

3. Click OK to close the Source Control Repository Properties dialog box.

Add a SourceGear Vault repository

1. Select SourceGear Vault from the Source Control system drop-down list box.

Add SourceGear Vault Repository

2. In Source control settings, specify:

  • Server address, Username and Password for the SourceGear Vault server. Optionally, select the Use SSL check-box for a secure connection.
  • SourceGear Vault Repository name.
  • Database Folder in SourceGear Vault repository that contains SQL scripts for your project.
  • Repository Name.

Note

To get proper settings, contact your system administrator.

Click Test to check the connection.

3. Click OK to close the Source Control Repository Properties dialog box.

Add a Perforce repository

1. Select Perforce (P4) from the Source Control system drop-down list box.

Add Perforce Repository

2. In Source control settings, specify:

2.1. P4Port, Username and Password for the Perforce server.

2.2. Workspace. You can create a new workspace or select an existing one from the drop-down list box.

Note

It is important to ensure that the Source Control feature of dbForge Schema Compare uses its own workspace for each database link.

It is not recommended that you use this workspace from other applications.

To create a new workspace:

  • Click New in the Workspace section of Source control settings.
  • In the New Workspace dialog box, specify:
  • The name of the new workspace
  • An existing Depot
  • The path to the Folder with database scripts. Click ‘…‘ to select an existing folder or create a new one.

New Workspace

Note

dbForge Schema Compare will work with scripts from this folder only. If you leave the Folder field empty, it will be considered that the whole depot contains database scripts. In this case, database scripts will be located in one of the Devart folders.

To select an existing workspace:

  • Select an existing workspace from the drop-down list. Workspace also specifies the local folder where dbForge Schema Compare will store database scripts.
  • Optionally, select Mapping from the drop-down list box. Mapping specifies the depot and the remote folder, that will be used by dbForge Schema Compare.

Note

  • Usage of existing workspace is not recommended due to possible conflicts with other applications or links.
  • For the correct work of the Source Control feature of dbForge Schema Compare, you and your colleagues must use identical settings for P4Port, Depot and Folder when configuring a new Workspace.
  • To get proper settings for P4Port, Username, Password, and Depot, contact your system administrator.

2.3. Repository name.

Click Test to check the connection.

3. Click OK to close the Source Control Repository Properties dialog box.

Add a Git repository

Note

Schema Compare supports Git for Windows client. Thanks to it you can work with all possible connection and authentication types as this task is delegated to the Git client. Before trying to connect your to a Git repository, make sure that you have Git for Windows client installed on your machine.

1. Select Git from the Source Control system drop-down list box and provide a path to your local Git repository that contains SQL scripts for your database project.

Note

To work with a remote repository, you need a clone of this repository. To retrieve a local clone, execute the git clone command or use the GUI tool. After a successful creation of the clone, specify the path to the folder containing the clone in the Repository Folder field of the Repository Properties window. You can specify a path to a subfolder in the repository (not .git).

Add Git Repository

Click Test to check the connection.

Note

Keep in mind that you should work with the current repository branch. For this, it must have at least one commit.

2. Click OK to close the Source Control Repository Properties dialog box.

See also: How to create a GIT repository from scratch on GitHub.

Add a Mercurial repository

1. Select Mercurial from the Source Control system drop-down list box.

Add Mercurial Repository

2. In Source control settings, specify:

  • To use a remote Mercurial repository, specify URL to the Mercurial server.
  • To use an existing Mercurial repository, select the Use existing local repository check-box, and specify the path to it.
  • Specify the repository name.

Note

To get proper settings, contact your system administrator.

Click Test to check the connection.

3. Click OK to close the Source Control Repository Properties dialog box.

If you want to configure the git-auto-commit action on every change in the structure of databases, refer to the How to Automatically Commit SQL Server Database Schema Changes to the GIT Repository article.

See also: Update to a revision from source control.