It would be great to have a way to make liquibase ignore some tables when generating a changelog or when diffing two databases.
Wa can ignore arbitrary object, not only tables: e.g. index, column, fk
We need this for some options in http://jhipster.github.io/
For example, a user can choose to use OAuth2, and the OAuth2 classes are provided by Spring Security -> so we have the schema, but we don't manage the entities (in fact, it's plain JDBC). And when we make a "diff", as those tables don't come from our JPA model, Liquibase wants to delete them.
I created a new liquibase.diff.output.ObjectChangeFilter interface that can be set on DiffChangeLog to control whether an object should be included in diff/generate changelog.
There is also now an includeObjects and excludeObjects parameter for Ant and command-line and a corresponding diffExcludeObjects and diffIncludeObjects config parameters for maven. If these parameters are set, a liquibase.diff.output.StandardObjectChangeFilter implementation is created that will filter objects based on the passed string.
The format supported is
An object name (actually a regexp) will match any object whose name matches the regexp.
A type:name syntax that matches the regexp name for objects of the given type
If you want multiple expressions, comma separate them
The type:name logic will be applied to the tables containing columns, indexes, etc.
NOTE: name comparison is case sensitive. If you want insensitive logic, use the `(?i)` regexp flag.
Example Filters:
"table_name" will match a table called "table_name" but not "other_table" or "TABLE_NAME"
"(i?)table_name" will match a table called "table_name" and "TABLE_NAME"
"table_name" will match all columns in the table table_name
"table:table_name" will match a table called table_name but not a column named table_name
"table:table_name, column:*._lock" will match a table called table_name and all columns that end with "_lock"
The subject for this task is "Ignore tables for diffs and generateChangelog" but I think it is true that this was only added for diffs, not for generateChangeLog right? Certainly, in the command line Liquibase, trying to add includeObjects or excludeObjects as a parameter throws an error:
SEVERE 8/9/16 9:19 AM: liquibase: Unknown parameter: 'includeObjects'
liquibase.exception.CommandLineParsingException: Unknown parameter: 'includeObjects'
at liquibase.integration.commandline.Main.parseOptions(Main.java:761)
at liquibase.integration.commandline.Main.run(Main.java:133)
at liquibase.integration.commandline.Main.main(Main.java:103)
"(i?)table_name" will match a table called "table_name" and "TABLE_NAME"
the example has a error - correct syntax for a case-insensitive table name is “(?i)table_name”