The Object status in the database source control

Applies to

ApexSQL Source Control

Summary

This article explains how to see information about the object status in the database source control.

Description

ApexSQL Source Control supports two development models for the database source control:

  • Dedicated – each developer has a local copy of a database on the local machine. Working in this development model means that only one developer will be working with the database and the object status can be changed only by that developer. So the object status does not make much difference like in the shared development model
  • Shared – all developers are working on the same database. In this development model, a larger number of developers can work at the same time on the same database, so it is useful to have information about the object status in order to prevent conflicts. The Object status feature provides all necessary information about the object status at any point in time

The pre-requisite to use the Object status feature is to have a linked database to source control in the shared development model.

The framework objects for database source control

When linking a database to source control in the shared development model with ApexSQL Source Control, by default, a separate database will be created (ApexSQL) for the framework objects storing:

Choosing a separate database

In the framework object database will be created five tables and two stored procedures that will contain information for all linked databases in the shared model on that SQL Server.

ApexSQL_SourceControl_DDLTrigger, the trigger for tracking changes made against any of the databases from that SQL Server linked in the shared development model, is the only framework object located outside that database:

The framework object for database linked in the shared development model of the database source control

Quick tip icon

Quick tip:

If Azure SQL Database service is used, the trigger for the databases linked to source control in the shared development model will be stored in the linked database

The framework object table which contains information about every object status from the databases linked in the shared development model is the ApexSQL_SouceControl. Objects table.

All relevant object status information can be listed by any database developer at any point in time through SQL Server Management Studio:

The framework table ApexSQL_SourceControl.Objects

Besides the object status (checked out, checked out and locked, edited, dropped) from this table, the user who is working on the specific database object will be listed as well.

The main disadvantage using this approach is that the finding the specific object in this table can be time-consuming since objects from all databases linked in the shared development model on that SQL Server will be stored in this table. The Object status feature from this database source control tool makes an easy approach to the same information, looking at the database level.

The Object status feature

To use the Object status in the database source control, after the database is linked to source control in the shared development model, right-click on it in the Object Explorer pane, and from the context menu choose the Object status command:

The Object status command from the right-click context menu of the database source control

The Object status window will be shown:

The Object status window in the database source control

The Object status window contains object status information for every object in the chosen linked database, including the information about the performed actions to particular objects (is that object checked out, edited or locked). In addition, under the User column, information about the database developer who changed the object status will be present.

The object status in the database source control can be changed only through the right-click Object Explorer pane context menu for one object at the time. Supported object status, through the Object Explorer pane context menu and the Object status window, are:

  • Check out – when the object is checked out using the right-click context menu in the Object Explorer pane, the displayed status of the object in the Object status window will be:

    How is displayed the status of the object in the Object status dialogue when the object is checked out

  • Check out and lock – when the object is checked out and locked in the Object Explorer pane, the following columns will be marked in the Object status window:

    How is displayed the status of the object in the Object status dialogue when the object is checked out and locked

  • Edit –schema change made against a database object will be treated as the object is edited, and in the right-click Object Explorer pane context menu will appear the Commit changes command. This object status change will be represented in the Object status window in the following way:

    How is displayed the status of the object in the Object status dialogue when the object is edited

    Quick tip icon

    Quick tip:

    he Commit changes option in the right-click Object Explorer pane context menu becomes available only when the selected database object is changed/edited in any way, not when the object is checked out or checked out and locked

  • Check out and edit – when the object is checked out and then edited, besides the Commit changes option availability in the Object Explorer pane of this database source control tool, in the Object status window the Checked out and Edited columns will be marked as well:

    How is displayed the status of the object in the Object status dialogue when the object is checked out and edited

  • Check out and lock and edit – when the object is checked out and locked and then edited, the object status shown in the Object status window will be:

    How is displayed the status of the object in the Object status dialogue when the object is checked out, locked and edited

FAQs

Q: Is the Object status option in this database source control tool available for the database linked in the dedicated development model?

A: No, the Object status option can be used only for database linked in the shared development model, where more database developers work on one shared database.

Q: Can I see which user changed the object status in the Object status window?

A: Yes, in the Object status window, we can see which user changed the object status under the User column.

Q: Can the checked out object be changed/altered/modified by any other database developer?

A: Yes, the checked out object can be changed by any other database developer, but only if it is first checked out by the database developer who wants to work on it.

Q: Can check out and locked object be changed by any other database developer?

A: No, in this case, the database developer who checked out and locked that object must either undo check out and lock or commit changes to the repository, so the object becomes available to other database developers.