SQL Server filtering
Published 29 July 2021
In v5, Redgate Change Control has been renamed to Flyway Desktop. Check out the latest documentation at https://documentation.red-gate.com/fd
Redgate Change Control supports SQL Compare-compatible filter rules, which provide a simple way to control the inclusion of objects within the script generation and reporting processes.
Filter rules provide the flexibility to allow both include and exclude rules to be specified for your project. Authoring the filter rules themselves can be done using the SQL Compare UI or by editing the filter files directly within a text editor.
Why use filters?
By default, Redgate Change Control will import all objects from the development database when you use Redgate Change Control to capture database changes. Although you can selectively un-check objects that you do not wish to import, it can be desirable to exclude certain objects from the import tool altogether (for example, to prevent any changes from being accidentally re-selected for save).
How it works
Use SQL Compare's filter designer to configure filter rules, and then export the rules to a file called Filter.scpf within the root of the Redgate Change Control project folder (that is, alongside the redgate-change-control.json file). When Redgate Change Control is used to capture new changes, the rules defined within the filter file will be applied: any objects that do not satisfy the rules will be excluded from the schema model.
Editing the filter rules
To edit the filter files after the initial setup has been performed, simply re-open the filter file within SQL Compare, make any necessary edits to the rules and click the Save icon within the Filter pane to overwrite the filter file.
Customizing the filter file path
A filter file will be picked up automatically if it is named Filter.scpf and in the root of the project folder. A different path can be specified if desired in the project settings file under capabilities.comparison.filter.
"capabilities": { "comparison": { "filter": "./Filter.scpf" } }