{"id":560,"date":"2021-03-09T19:35:59","date_gmt":"2021-03-09T19:35:59","guid":{"rendered":"https:\/\/www.versionsql.com\/help\/documentation\/settings\/global-exclusion-patterns\/"},"modified":"2022-02-15T21:32:18","modified_gmt":"2022-02-15T21:32:18","slug":"global-ignore-patterns","status":"publish","type":"docs","link":"https:\/\/www.versionsql.com\/help\/documentation\/global-settings\/global-ignore-patterns\/","title":{"rendered":"Global Ignore Patterns"},"content":{"rendered":"<p>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).<\/p>\n<p>When running a commit, VersionSQL first matches each object&#8217;s path against these patterns. Only objects that pass continue on to the next step in the commit process.<\/p>\n<p>Follows the gitignore spec. See\u00a0<a href=\"https:\/\/git-scm.com\/docs\/gitignore\">gitignore documentation<\/a>\u00a0for the full range of capabilities available.<\/p>\n<div class=\"wedocs-callout callout-blue\">Note: Since they conform to the gitignore spec, ignore patterns are matched against object destination file paths with unix-style directory separators (e.g. \/View\/uvw_Test.sql)<\/div>\n<h3>Example use cases:<\/h3>\n<h4>Exclude objects based on suffix<\/h4>\n<p>Say you have some encrypted objects in your database, all helpfully suffixed with <code>_enc<\/code>. You can exclude these from every commit by adding this line to the Global Ignore Patterns text box:<\/p>\n<pre><code class=\"language-gitignore\"># Ignore objects with an _enc suffix\r\n*_enc.sql<\/code><\/pre>\n<h4><\/h4>\n<p>&nbsp;<\/p>\n<h4>Exclude objects based on prefix<\/h4>\n<p>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&#8217;s a few examples for you:<\/p>\n<pre><code class=\"language-gitignore\"># Ignore objects with an ERP_ prefix\r\n*\/ERP_*\r\n\r\n# Ignore tables with an IM_ prefix\r\nTable\/IM_*\r\n\r\n# Ignore everything in the ERP schema\r\nERP\/<\/code><\/pre>\n<h4><\/h4>\n<p>&nbsp;<\/p>\n<h4>Include only certain objects (whitelist)<\/h4>\n<p>Maybe your tables are organized, while the ERP system is a free-for-all. No problem, just ignore everything that doesn&#8217;t match your pattern:<\/p>\n<pre><code class=\"language-gitignore\"># Ignore all objects\r\n*\r\n\r\n# Except those starting with an underscore\r\n# 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.\r\n!*\/_*\r\n\r\n# Also include any object containing the word \"test\"\r\n!test*\r\n\r\n# And this particular view\r\n!*\/View\/uvw_test.sql<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h4>Apply filters to certain databases<\/h4>\n<p>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 &#8220;AdventureWorks&#8221;, and everything in the WideWorldImporters database. Everything else, including in other databases, will be excluded.<\/p>\n<pre><code class=\"language-gitignore\"># Exclude everything\r\n*\r\n\r\n# Include Sales schema in AdventureWorks databases\r\n!*\/AdventureWorks*\/Sales\/*\r\n\r\n# Include everything in this database\r\n!*\/WideWorldImporters\/*\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>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.<\/p>\n<pre><code class=\"language-gitignore\"># Exclude everything in AdventureWorks databases\r\n*\/AdventureWorks*\r\n\r\n# Include Sales schema in AdventureWorks databases\r\n!*\/AdventureWorks*\/Sales\/*\r\n<\/code><\/pre>\n","protected":false},"author":1,"featured_media":0,"parent":557,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"footnotes":""},"doc_tag":[],"class_list":["post-560","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/docs\/560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/comments?post=560"}],"version-history":[{"count":19,"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/docs\/560\/revisions"}],"predecessor-version":[{"id":1123,"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/docs\/560\/revisions\/1123"}],"up":[{"embeddable":true,"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/docs\/557"}],"next":[{"title":"External Diff and Merge Tool","link":"https:\/\/www.versionsql.com\/help\/documentation\/global-settings\/external-diff-and-merge-tool\/","href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/docs\/561"}],"wp:attachment":[{"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/media?parent=560"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.versionsql.com\/help\/wp-json\/wp\/v2\/doc_tag?post=560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}