Package org.liquibase.maven.plugins
Class LiquibaseDatabaseDiff
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.liquibase.maven.plugins.AbstractLiquibaseMojo
org.liquibase.maven.plugins.AbstractLiquibaseChangeLogMojo
org.liquibase.maven.plugins.LiquibaseDatabaseDiff
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
Generates a diff between the specified database and the reference database. The output is either a report or a changelog depending on the value of the diffChangeLogFile parameter.
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The author to be specified for Changesets in the generated Change Log.protected String
If this parameter is set, the changelog needed to "fix" differences between the two databases is output.protected String
Objects to be excluded from the changelog.protected boolean
Include the catalog in the diff output?protected String
Objects to be included in the changelog.protected boolean
Include the schema in the diff output?protected boolean
Include the tablespace in the diff output?protected String
List of diff types to include in Change Log expressed as a comma separated list from: tables, views, columns, indexes, foreignkeys, primarykeys, uniqueconstraints, data.protected String
The format in which to display the diff output TXT or JSONprotected String
Write the output of the diff to a fileprotected String
Output schemas names.protected String
The reference database catalog.protected String
The reference database schema.protected String
The fully qualified name of the driver class to use to connect to the reference database.protected String
The reference database password to use to connect to the specified database.protected String
Schemas names on reference database to use in diff.protected String
The server id in settings.xml to use when authenticating with.protected String
The reference database URL to connect to for executing Liquibase.protected String
The reference database username to use to connect to the specified database.protected String
Sets replaceIfExists="true" for changes of the supported types, at the moment they are createView and createProcedure.protected String
Sets runOnChange="true" for changesets containing solely changes of these types (e.g. createView, createProcedure, ...).protected String
Schemas on target database to use in diff.protected boolean
Flag to allow adding 'OR REPLACE' option to the create view change object when generating changelog in SQL formatFields inherited from class org.liquibase.maven.plugins.AbstractLiquibaseChangeLogMojo
changeLogDirectory, changeLogFile, contexts, duplicateFileMode, labelFilter, labels
Fields inherited from class org.liquibase.maven.plugins.AbstractLiquibaseMojo
analyticsEnabled, changeExecListenerClass, changeExecListenerPropertiesFile, changelogCatalogName, changelogSchemaName, clearCheckSums, commandName, databaseChangelogHistoryCaptureExtensions, databaseChangelogHistoryCaptureSql, databaseChangelogHistoryEnabled, databaseChangeLogLockTableName, databaseChangeLogTableName, databaseClass, dbclHistoryCaptureExtensions, dbclHistoryCaptureSql, dbclHistoryEnabled, defaultCatalogName, defaultChangeExecListener, defaultSchemaName, driver, emptyPassword, includeArtifact, includeTestOutputDirectory, logFormat, logging, logLevel, mojoExecution, outputDefaultCatalog, outputDefaultSchema, outputFileEncoding, password, preserveSchemaCase, project, promptOnNonLocalDatabase, propertyFile, propertyFileWillOverride, propertyProviderClass, psqlArgs, psqlKeepTemp, psqlKeepTempName, psqlKeepTempPath, psqlLogFile, psqlPath, psqlTimeout, searchPath, session, showBanner, skip, skipOnFileExists, sqlcmdArgs, sqlcmdCatalogName, sqlcmdKeepTemp, sqlcmdKeepTempName, sqlcmdKeepTempOverwrite, sqlcmdKeepTempPath, sqlcmdLogFile, sqlcmdPath, sqlcmdTimeout, sqlPlusArgs, sqlPlusKeepTemp, sqlPlusKeepTempName, sqlPlusKeepTempOverwrite, sqlPlusKeepTempPath, sqlPlusLogFile, sqlPlusPath, sqlPlusTimeout, suppressLiquibaseSql, systemProperties, url, username, vaultAddr, vaultNamespace, vaultToken, verbose, wagonManager
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Performs some validation after the properties file has been loaded checking that all properties required have been specified.void
execute()
protected void
performLiquibaseTask
(Liquibase liquibase) Performs the actual Liquibase task on the database using the fully configuredLiquibase
.protected void
printSettings
(String indent) Prints the settings that have been set of defaulted for the plugin.Methods inherited from class org.liquibase.maven.plugins.AbstractLiquibaseChangeLogMojo
createLiquibase, getLabelFilter, getResourceAccessor
Methods inherited from class org.liquibase.maven.plugins.AbstractLiquibaseMojo
cleanup, configureChangeLogProperties, configureFieldsAndValues, databaseConnectionRequired, getClassLoaderIncludingProjectClasspath, getField, getLicenseKey, getLiquibase, getLog, getMavenArtifactClassLoader, getOutputStream, getOutputWriter, isPromptOnNonLocalDatabase, parsePropertiesFile, setPassword, setupBindInfoPackage, setUrl, setUsername, setVaultAddr, setVaultNamespace, setVaultToken
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getPluginContext, setLog, setPluginContext
-
Field Details
-
referenceDriver
The fully qualified name of the driver class to use to connect to the reference database. If this is not specified, then theAbstractLiquibaseMojo.driver
will be used instead. -
referenceUrl
The reference database URL to connect to for executing Liquibase. -
referenceUsername
The reference database username to use to connect to the specified database. -
referencePassword
The reference database password to use to connect to the specified database. If this is null then an empty password will be used. -
referenceDefaultCatalogName
The reference database catalog. -
referenceDefaultSchemaName
The reference database schema. -
diffChangeLogFile
If this parameter is set, the changelog needed to "fix" differences between the two databases is output. If the file exists, it is appended to. If this is null, a comparison report is output to stdout. -
diffIncludeCatalog
Include the catalog in the diff output? If this is null then the catalog will not be included -
diffIncludeSchema
Include the schema in the diff output? If this is null then the schema will not be included -
diffIncludeTablespace
Include the tablespace in the diff output? If this is null then the tablespace will not be included -
diffTypes
List of diff types to include in Change Log expressed as a comma separated list from: tables, views, columns, indexes, foreignkeys, primarykeys, uniqueconstraints, data. If this is null then the default types will be: tables, views, columns, indexes, foreignkeys, primarykeys, uniqueconstraints -
changeSetAuthor
The author to be specified for Changesets in the generated Change Log. -
diffExcludeObjects
Objects to be excluded from the changelog. Example filters: "table_name", "table:main_.*", "column:*._lock, table:primary.*". -
diffIncludeObjects
Objects to be included in the changelog. Example filters: "table_name", "table:main_.*", "column:*._lock, table:primary.*". -
referenceServer
The server id in settings.xml to use when authenticating with. -
schemas
Schemas on target database to use in diff. This is a CSV list. -
referenceSchemas
Schemas names on reference database to use in diff. This is a CSV list. -
outputSchemas
Output schemas names. This is a CSV list. -
outputFile
Write the output of the diff to a file -
format
The format in which to display the diff output TXT or JSON -
runOnChangeTypes
Sets runOnChange="true" for changesets containing solely changes of these types (e.g. createView, createProcedure, ...). -
replaceIfExistsTypes
Sets replaceIfExists="true" for changes of the supported types, at the moment they are createView and createProcedure. -
useOrReplaceOption
Flag to allow adding 'OR REPLACE' option to the create view change object when generating changelog in SQL format
-
-
Constructor Details
-
LiquibaseDatabaseDiff
public LiquibaseDatabaseDiff()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Specified by:
execute
in interfaceorg.apache.maven.plugin.Mojo
- Overrides:
execute
in classAbstractLiquibaseMojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
performLiquibaseTask
Description copied from class:AbstractLiquibaseChangeLogMojo
Performs the actual Liquibase task on the database using the fully configuredLiquibase
.- Overrides:
performLiquibaseTask
in classAbstractLiquibaseChangeLogMojo
- Parameters:
liquibase
- TheLiquibase
that has been fully configured to run the desired database task.- Throws:
LiquibaseException
-
printSettings
Description copied from class:AbstractLiquibaseMojo
Prints the settings that have been set of defaulted for the plugin. These will only be shown in verbose mode.- Overrides:
printSettings
in classAbstractLiquibaseChangeLogMojo
- Parameters:
indent
- The indent string to use when printing the settings.
-
checkRequiredParametersAreSpecified
protected void checkRequiredParametersAreSpecified() throws org.apache.maven.plugin.MojoFailureExceptionDescription copied from class:AbstractLiquibaseMojo
Performs some validation after the properties file has been loaded checking that all properties required have been specified.- Overrides:
checkRequiredParametersAreSpecified
in classAbstractLiquibaseChangeLogMojo
- Throws:
org.apache.maven.plugin.MojoFailureException
- If any property that is required has not been specified.
-