How to use the Change log feature in ApexSQL Source Control

Applies to

ApexSQL Source Control

Summary

This article explains how to see changes in this SQL source control tool made by any developer against a database linked in the shared development model using the Change log feature.

Description

When working in a multi-developer environment where multiple changes occur in a database, it is helpful to have information about those changes at the minute they happen. Using ApexSQL Source Control, all those changes can be logged with the Change log feature, which will be explained in this article.

How to work with the Change log feature

Enabling the Change log feature

The pre-requisite to use the Change log feature is to have a linked database in the shared development model. To do that, right-click on a database in the Object Explorer pane, and from the context menu choose the Link database to source control option:

The Link database to source control command from the Object Explorer pane right-click context menu

Information on how to link a database with this SQL source control tool can be found in How to link a SQL Server database to a source control system article.

In order to track all the changes made by every database developer on a database, the Change log option first must be enabled because it’s disabled by default.

To enable the Change log feature, go to the ApexSQL menu in SQL Server Management Studio (SSMS), and click on the Options command from the ApexSQL Source Control menu:

The Options command from the ApexSQL Source Control menu in SSMS

The Options window will be shown:

The Options window

Under the Administration tab, choose the linked database in the shared development model from the Database drop-down list:

The Choose a database drop-down list in the Administration tab of the Options window

For the chosen database, check the Log changes option under the Misc heading and click the OK button to save the option settings:

The Log changes option in Administration tab from the Options window

Working with the Change log feature

When the Change Log option is enabled, all changes made against the specific database will be tracked and recorded in the framework table ApexSQL_SourceControl.ChangeLog located in the framework database (by default ApexSQL), no matter which database developer made those changes:

The framework object table ApexSQL_SourceControl.ChangeLog in the framework object database ApexSQL

To see database-level changes, right-click on the database in the Object Explorer pane, and from the More Source control options submenu choose the Database change log option:

The Database change log option in the More source control options submenu from the Object Explorer pane right-click context menu

The Database change log window will be shown containing the following columns:

  • Edited – date and time when the object was edited
  • Object – the name of the edited object
  • Type the type of edited object (table, procedure, view…)
  • Schema – the object of the edited object
  • User – the user who edited the object

The Database change log window

When an object is selected from the list, at the bottom of the Database change log window of this SQL source control tool, the object change script will be shown.

Working with object-level changes

To see information about changes related to one database object, right-click on that object in the Object Explorer pane, and from the More source control options submenu choose the Object change log command:

The Object change log option in the More source control options submenu from the Object Explorer pane right-click context menu

The Object change log window will be shown containing two columns:

  • Edited – date and time when the object was edited
  • User – the user who edited the object

The Object change log window

When a listed change is selected, by the time when it is made or by the user who made it, at the bottom of the Object change log window of this SQL source control tool, the object change script will be shown.

FAQs

Q: Can the Change log feature of this SQL source control tool track changes to a database linked in the dedicated model?

A: If the database is linked in the dedicated development model, the Change log feature will not be available. This feature is reserved only to databases linked in the shared development model.

Q: Will change log information still be available after unlinking a database?

A: No, because all framework objects related to a database will be deleted after the database is unlinked.

Q: Can any user see changes logged using the Database change log option?

A: Yes. Any user with permissions to see the framework object database (by default, the ApexSQL database) can see these changes.