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

The Get Latest feature cannot be used if you link a database in the shared database mode, because the shared database is always kept up to date with changes made by others.

To start working with Source Control Manager, first, you need to link a database to the version control repository. To do that, follow the steps in the how-to topics depending on the source control or version control systems you use:

The linked database gets the following icon in Object Explorer:

Source Control label

After the database has been linked to the remote repository, dbForge Source Control checks whether any changes were made to the database locally or remotely and committed to the repository. In addition, the tool checks if there are any conflicts meaning that several developers were making changes to the same file both in the repository and in the 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

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
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

If you select not all objects in the Remote changes section but only one that depends on other objects or changes, then after clicking Get Latest, you will see the following window with the suggestion to include all affected 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 executes the deployment script generated by dbForge Source Control against the linked database to the remote repository. The script includes the CREATE, ALTER, and/or DROP statements based on the database objects selected in Source Control Manager as well as INSERT, UPDATE, and/or DELETE statements for the static data changes and on the statuses (Remove, Modify, Add) that the objects had.

So, remote changes made in a version control repository have successfully been deployed to the database with the help of dbForge Source Control.