Get the latest version

dbForge Source Control helps to update your database with the latest changes from version control by deploying the changes to your database.

Note

In the Shared development model, the Get Latest feature is not available, as all developers are working on the same database. To learn more, refer to Shared model.

Before you can use the Source Control Manager, you must first link a database to the version control repository by following the steps outlined in the relevant how-to topic:

A linked database gets the following icon in Object Explorer:

Source Control label

Note

It is important to link static data to source control to prevent any data loss when updating your local database with the latest changes from the remote repository or reverting database changes made to the object and static data in a database.

dbForge Source Control checks whether any changes were made to the database locally or remotely and whether these changes were committed to the repository. In the same way, dbForge Source Control checks whether any changes were committed to the version control and whether these changes were deployed to the linked database.

In addition, the tool checks for conflicts that can occur when multiple developers are making changes to the same file both in the repository and in the local database.

The Refresh progress window opens automatically, showing the stages of the refresh operation.

Refresh

After the refresh operation is complete, Source Control Manager opens displaying all the changes in the following sections:

It should be noted that Source Control Manager can display either all three sections or two of them or just one section.

The tool distributes the changes in the following sections

Local changes section

The Add change type in Local Changes indicates that the object was created locally in the database that is being version-controlled using Source Control, and has not been committed to the remote repository yet. By selecting the object and clicking Undo, it will be removed from the local database.

The Remove change type in Local Changes means that the object was deleted from the local database that is being version-controlled using Source Control, but is still present in the remote repository. By selecting the object and clicking Undo, it will be restored in the local database.

The Modify change type in Local Changes signifies that changes were made to the object in the local database that is being version-controlled using Source Control. As a result, the object’s DDL in the local database differs from the version stored in the remote repository. Selecting the object and clicking Undo will discard the changes made to the object in the local database, reverting it to the version from the repository.

Remote changes section

The Add change type in Remote Changes indicates that the object has been added to the remote repository since the last synchronization, and is not present in the local database that is linked to this repository via Source Control. By clicking Get Latest the object will be added to the local database.

The Remove change type in Remote Changes means that the object has been removed from the remote repository since the last synchronization but is present in the local database that is linked to this repository via Source Control. By clicking Get Latest the object will be removed from the local database.

The Modify change type in Remote Changes indicates that the object has been modified in the remote repository since the last synchronization. As a result, the object’s DDL in the repository differs from the version stored in the local database that is linked to this repository via Source Control. By clicking Get Latest, the object in the local database will be updated to match the version from the repository.

If the database and version control repository are identical and no changes are found, the following window is displayed:

The database and version control repository are identical

To get the latest changes from version control and deploy them to the database:

In the Remote changes section, select the checkboxes next to the objects and/or static data that you want to deploy and then click Get Latest.

Note

If you select the checkbox next to Remote changes, all changes will be selected.

Getting the latest version

As you can see in the screenshot above, the Source Control grid contains the following columns:

Column Description
Change Type Actions to be applied to the object or static data in the linked database; these include Add (the object will be created, the data will be inserted); Modify (the object will be altered, the data will be updated); Remove (the object will be dropped, the data will be deleted)
Type The type of the object; a Static Data is a table’s data type
Name The name of the object that will undergo changes; a <name> (Data) construction refers to static data
Owner The schema or database in which the object was created

Note

Static data must be linked to version control before the deployment.

If you select an object that depends on other objects or changes in the Remote changes section, clicking Get Latest will display a window with a suggestion to include all related objects:

Dependencies window

This case may occur when you add, for example, two new database objects such as a table and a view, which select data from this new table. So, when you choose to deploy remote changes made only to the new view, you will be suggested to deploy the table associated with this view. In addition, you can exclude any related object from the deployment.

Note

When working with changes that influence both the schema and data, data loss may potentially take place. In such cases, dbForge Source Control will notify you accordingly and will prompt to back up your database.

Getting the latest version

After clicking Get Latest, the Get Latest progress window opens, showing the stages of the operation. When all the stages are complete, click OK to close the progress window.

Getting the latest version

The Get Latest operation runs the deployment script generated by dbForge Source Control against the linked database to update it with the latest version of the database stored in the remote repository. The script contains CREATE, ALTER, and/or DROP statements for the database objects selected in the Source Control Manager, as well as INSERT, UPDATE, and/or DELETE statements for the changes to static data and the statuses (Remove, Modify, Add) of the objects.

Note

When clicking Get Latest, dbForge Source Control may encounter issues applying changes to the stored procedures with Linked Servers that don’t allow distributed transactions. As a workaround, use Schema Compare for SQL Server to adjust the transaction isolation level before running Get Latest.

In Schema Compare, use the Set transaction isolation level to option to choose an appropriate level:

  • REPEATABLE READ
  • SNAPSHOT

For detailed instructions on setting synchronization options, see Configure synchronization options.

To learn more about deploying database changes using Source Control, refer to Deploy from Source Control.

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Source Control for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Source Control in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the Source Control for your business, request a demo to see it in action.
Ready to start using dbForge Source Control for SQL Server?