Applies to
ApexSQL Source Control
Summary
This article explains how to work with the Object filtering feature in ApexSQL Source Control.
Description
Usually, there is no need to add all the database objects to source control at once. In addition to this, the user could stop versioning a set of objects or start versioning objects that were not under source control. In this case, the Object filtering option will be used to filter objects, specifically to include or exclude them from being version controlled.
Objects can be excluded from source control during the database linking process, in the Object filtering step of the Source control wizard, or at a later stage from the Options dialog.
Object filtering in the Source control wizard
By default, all schemas, object types and individual objects are selected for versioning:
To exclude a specific schema from being version controlled, deselect it from the Schema drop down list:
|
Quick tip: If you uncheck a SQL schema, all underlying objects will be automatically unchecked (excluded from versioning) |
To exclude all the objects of a specific type, uncheck it in the Type drop-down list:
In addition to the previously described filtering, a more advanced way to granularly exclude objects from source control is to review a list of individual objects. Using the Show objects option, a list of all objects from the selected database will be loaded. By unchecking any of the object it will be excluded from versioning:
All columns in the objects grid have built-in filters that allows the user to find the specific object easily. This can be achieved by clicking the Filter icon in the upper right corner of a column header (for example the Object column). Let’s say we want to filter all tables that start with Customer. Under the Test filters tab, we’ll pick the Begins with condition and specify Customer in the text field:
This filters all objects that start with Customer. At this point, we can, for example, exclude the Customer table:
Once the Object filtering is configured, a list of selected objects can be exported into an xml file, using the Export button. In an equivalent way, previously saved Object filtering settings can be imported using the Import button:
|
Quick tip: If multiple developers are working on the same set of objects, one can filter the specific set of objects and export it, so the rest of the team can simply import the filtering configuration at this step |
Object filtering in the Options dialog
Once a database is linked, there is no way to get back to the Source control wizard in order to change the object filtering settings, unless a database is re-linked. However, for all linked databases, filtering does not require re-linking a database as the filtering configuration can be changed in the Options dialog:
Unlike the Object filtering step in the Source control wizard, where only a single database is managed, the Options dialog requires that the user must select a SQL Server instance and a database to change the Object filtering settings for.
|
Quick tip: In the Object filtering step, all connected servers and all linked databases are displayed, regardless of whether they are linked using the Shared or the Dedicated model |
Local settings
The Local settings tab works in the same way as described for the Source control wizard. That means objects can be excluded and included from a local machine at any point. Local settings are bounde to a user on a local machine, or to be specific to a Windows account that is logged on. If, for example, one user makes some configuration changes in the Object filtering step, that won’t affect users that are working on a separate machines or users that are using the same machine but different Windows account.
|
Quick tip: Database policies continue to affect objects that are excluded |
Global settings
The Global settings tab seems to be similar to Local settings tab. The main difference is that in the Global settings tab only databases linked using the Shared model are available.
If there are no database links in the Shared model, we cannot access the Global settings option and as the following message appears:
All database objects that are under source control are recognizable by the specific icon in the Object Explorer pane:
In the above image, we can see that some tables are excluded from the source control (Dimension.City, Dimension.Customer).
Q: Why I can’t start Global settings in Object filtering menu?
A: If you use only databases in Dedicated model, you can’t start Global settings. Global settings are only for databases linked in Shared model.
Q: Why, in the Global settings menu, can’t I see the Import and Export options?
A: In a database linked in the Shared model all your settings about Object filtering are saved in the Framework database table (In default case that is in ApexSQL database under ApexSQL_SourceControl.ExludedObjects table), and all users can access to it.