How to get the latest version

dbForge Studio for SQL Server helps update the 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 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 Database 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.

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

In addition, the Source Control tool scans for conflicts that can occur when multiple developers make changes to the same file 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, the Source Control Manager opens, displaying all the changes in the following sections:

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

The tool distributes the changes in the following sections

Note

Local changes section

  • The Add change type indicates that the object was created locally in the database that is version-controlled using Source Control, and has not been committed to the remote repository yet. Selecting the object and clicking Undo will remove it from the local database.
  • The Remove change type means that the object was deleted from the local database that is version-controlled using Source Control, but is still present in the remote repository. Selecting the object and clicking Undo will restore it in the local database.
  • The Modify change type signifies that changes were made to the object in the local database that is 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 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. Clicking Get Latest will add the object to the local database.
  • The Remove change type 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. Clicking Get Latest will remove the object from the local database.
  • The Modify change type 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. Clicking Get Latest will update the object in the local database 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 you want to deploy and 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), and Remove (the object will be dropped, the data will be deleted)
Type The type of the object. 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 selects 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 take place. In such cases, the tool will notify you accordingly and will prompt you 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 the Source Control tool 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.

For more information about specific cases when deploying the changes to the database, see Deploy changes when databases are linked or disconnected from source control.

Download dbForge Studio for SQL Server and try it absolutely free for 30 days!

Want to Find out More?

Overview

Overview

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

All features

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

Request a demo

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