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
FieldsModifier and TypeFieldDescriptionprotected StringThe author to be specified for Changesets in the generated Change Log.protected StringIf this parameter is set, the changelog needed to "fix" differences between the two databases is output.protected StringObjects to be excluded from the changelog.protected booleanInclude the catalog in the diff output?protected StringObjects to be included in the changelog.protected booleanInclude the schema in the diff output?protected booleanInclude the tablespace in the diff output?protected StringList of diff types to include in Change Log expressed as a comma separated list from: tables, views, columns, indexes, foreignkeys, primarykeys, uniqueconstraints, data.protected StringWrite the output of the diff to a fileprotected StringOutput schemas names.protected StringThe reference database catalog.protected StringThe reference database schema.protected StringThe fully qualified name of the driver class to use to connect to the reference database.protected StringThe reference database password to use to connect to the specified database.protected StringSchemas names on reference database to use in diff.protected StringThe server id in settings.xml to use when authenticating with.protected StringThe reference database URL to connect to for executing Liquibase.protected StringThe reference database username to use to connect to the specified database.protected StringSets replaceIfExists="true" for changes of the supported types, at the moment they are createView and createProcedure.protected StringSets runOnChange="true" for changesets containing solely changes of these types (e.g. createView, createProcedure, ...).protected StringSchemas on target database to use in diff.protected booleanFlag 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, labelsFields inherited from class org.liquibase.maven.plugins.AbstractLiquibaseMojo
analyticsEnabled, changeExecListenerClass, changeExecListenerPropertiesFile, changelogCatalogName, changelogSchemaName, clearCheckSums, commandName, databaseChangeLogLockTableName, databaseChangeLogTableName, databaseClass, defaultCatalogName, defaultChangeExecListener, defaultSchemaName, driver, emptyPassword, includeArtifact, includeTestOutputDirectory, logging, logLevel, mojoExecution, outputDefaultCatalog, outputDefaultSchema, outputFileEncoding, password, preserveSchemaCase, project, promptOnNonLocalDatabase, propertyFile, propertyFileWillOverride, propertyProviderClass, searchPath, session, showBanner, skip, skipOnFileExists, suppressLiquibaseSql, systemProperties, url, username, verbose, wagonManagerFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerforms some validation after the properties file has been loaded checking that all properties required have been specified.voidexecute()protected voidperformLiquibaseTask(Liquibase liquibase) Performs the actual Liquibase task on the database using the fully configuredLiquibase.protected voidprintSettings(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, getResourceAccessorMethods inherited from class org.liquibase.maven.plugins.AbstractLiquibaseMojo
cleanup, configureChangeLogProperties, configureFieldsAndValues, databaseConnectionRequired, getClassLoaderIncludingProjectClasspath, getField, getLiquibase, getLog, getMavenArtifactClassLoader, getOutputStream, getOutputWriter, isPromptOnNonLocalDatabase, parsePropertiesFile, setupBindInfoPackageMethods 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.driverwill 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 -
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:
executein interfaceorg.apache.maven.plugin.Mojo- Overrides:
executein classAbstractLiquibaseMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
performLiquibaseTask
Description copied from class:AbstractLiquibaseChangeLogMojoPerforms the actual Liquibase task on the database using the fully configuredLiquibase.- Overrides:
performLiquibaseTaskin classAbstractLiquibaseChangeLogMojo- Parameters:
liquibase- TheLiquibasethat has been fully configured to run the desired database task.- Throws:
LiquibaseException
-
printSettings
Description copied from class:AbstractLiquibaseMojoPrints the settings that have been set of defaulted for the plugin. These will only be shown in verbose mode.- Overrides:
printSettingsin 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:AbstractLiquibaseMojoPerforms some validation after the properties file has been loaded checking that all properties required have been specified.- Overrides:
checkRequiredParametersAreSpecifiedin classAbstractLiquibaseChangeLogMojo- Throws:
org.apache.maven.plugin.MojoFailureException- If any property that is required has not been specified.
-