Filter objects out of commits via a set of patterns. Can be used as a blacklist and/or a whitelist (i.e. to only include objects matching certain patterns).
When running a commit, VersionSQL first matches each object’s path against these patterns. Only objects that pass continue on to the next step in the commit process.
Follows the gitignore spec. See gitignore documentation for the full range of capabilities available.
Example use cases:
Exclude objects based on suffix
Say you have some encrypted objects in your database, all helpfully suffixed with
_enc. You can exclude these from every commit by adding this line to the Global Ignore Patterns text box:
# Ignore objects with an _enc suffix *_enc.sql
Exclude objects based on prefix
Need to exclude all your ERP system tables? Do they follow a naming scheme or are they organized in a particular set of schemas? Great! Here’s a few examples for you:
# Ignore objects with an ERP_ prefix */ERP_* # Ignore tables with an IM_ prefix Table/IM_* # Ignore everything in the ERP schema ERP/
Include only certain objects (whitelist)
Maybe your tables are organized, while the ERP system is a free-for-all. No problem, just ignore everything that doesn’t match your pattern:
# Ignore all objects * # Except those starting with an underscore # The ! prefix means "except". "*/" says "in any directory", and is used here to ensure the underscore won't match in the middle of the object name. !*/_* # Also include any object containing the word "test" !test* # And this particular view !*/View/uvw_test.sql
Apply filters to certain databases
Since the patterns are based on the file path in the repo, you can write rules for specific databases by including the database name in the pattern. For example, the following will whitelist only the Sales schema in databases that start with “AdventureWorks”, and everything in the WideWorldImporters database. Everything else, including in other databases, will be excluded.
# Exclude everything * # Include Sales schema in AdventureWorks databases !*/AdventureWorks*/Sales/* # Include everything in this database !*/WideWorldImporters/*
You can make the pattern more targeted by excluding-then-including only the target database. For instance, in the below pattern, the WideWorldImporters database will not be affected.
# Exclude everything in AdventureWorks databases */AdventureWorks* # Include Sales schema in AdventureWorks databases !*/AdventureWorks*/Sales/*