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
public class LiquibaseDatabaseDiff extends AbstractLiquibaseChangeLogMojo
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
Fields Modifier and Type Field Description protected String
changeSetAuthor
The author to be specified for Changesets in the generated Change Log.protected String
diffChangeLogFile
If this parameter is set, the changelog needed to "fix" differences between the two databases is output.protected String
diffExcludeObjects
Objects to be excluded from the changelog.protected boolean
diffIncludeCatalog
Include the catalog in the diff output? If this is null then the catalog will not be includedprotected String
diffIncludeObjects
Objects to be included in the changelog.protected boolean
diffIncludeSchema
Include the schema in the diff output? If this is null then the schema will not be includedprotected boolean
diffIncludeTablespace
Include the tablespace in the diff output? If this is null then the tablespace will not be includedprotected String
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.protected String
format
The format in which to display the diff output TXT or JSONprotected String
outputFile
Write the output of the diff to a fileprotected String
outputSchemas
Output schemas names.protected String
referenceDefaultCatalogName
The reference database catalog.protected String
referenceDefaultSchemaName
The reference database schema.protected String
referenceDriver
The fully qualified name of the driver class to use to connect to the reference database.protected String
referencePassword
The reference database password to use to connect to the specified database.protected String
referenceSchemas
Schemas names on reference database to use in diff.protected String
referenceServer
The server id in settings.xml to use when authenticating with.protected String
referenceUrl
The reference database URL to connect to for executing Liquibase.protected String
referenceUsername
The reference database username to use to connect to the specified database.protected String
replaceIfExistsTypes
Sets replaceIfExists="true" for changes of the supported types, at the moment they are createView and createProcedure.protected String
runOnChangeTypes
Sets runOnChange="true" for changesets containing solely changes of these types (e.g.protected String
schemas
Schemas on target database to use in diff.protected boolean
useOrReplaceOption
Flag to allow adding 'OR REPLACE' option to the create view change object when generating changelog in SQL format-
Fields inherited from class org.liquibase.maven.plugins.AbstractLiquibaseChangeLogMojo
changeLogDirectory, changeLogFile, contexts, duplicateFileMode, labelFilter, labels
-
Fields inherited from class org.liquibase.maven.plugins.AbstractLiquibaseMojo
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, systemProperties, url, username, verbose, wagonManager
-
-
Constructor Summary
Constructors Constructor Description LiquibaseDatabaseDiff()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkRequiredParametersAreSpecified()
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
-
-
-
-
Field Detail
-
referenceDriver
@PropertyElement protected String 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
@PropertyElement protected String referenceUrl
The reference database URL to connect to for executing Liquibase.
-
referenceUsername
@PropertyElement protected String referenceUsername
The reference database username to use to connect to the specified database.
-
referencePassword
@PropertyElement protected String 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
@PropertyElement protected String referenceDefaultCatalogName
The reference database catalog.
-
referenceDefaultSchemaName
@PropertyElement protected String referenceDefaultSchemaName
The reference database schema.
-
diffChangeLogFile
@PropertyElement protected String 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
@PropertyElement protected boolean diffIncludeCatalog
Include the catalog in the diff output? If this is null then the catalog will not be included
-
diffIncludeSchema
@PropertyElement protected boolean diffIncludeSchema
Include the schema in the diff output? If this is null then the schema will not be included
-
diffIncludeTablespace
@PropertyElement protected boolean diffIncludeTablespace
Include the tablespace in the diff output? If this is null then the tablespace will not be included
-
diffTypes
@PropertyElement protected String 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
@PropertyElement protected String changeSetAuthor
The author to be specified for Changesets in the generated Change Log.
-
diffExcludeObjects
@PropertyElement protected String diffExcludeObjects
Objects to be excluded from the changelog. Example filters: "table_name", "table:main_.*", "column:*._lock, table:primary.*".
-
diffIncludeObjects
@PropertyElement protected String diffIncludeObjects
Objects to be included in the changelog. Example filters: "table_name", "table:main_.*", "column:*._lock, table:primary.*".
-
referenceServer
@PropertyElement protected String referenceServer
The server id in settings.xml to use when authenticating with.
-
schemas
@PropertyElement protected String schemas
Schemas on target database to use in diff. This is a CSV list.
-
referenceSchemas
@PropertyElement protected String referenceSchemas
Schemas names on reference database to use in diff. This is a CSV list.
-
outputSchemas
@PropertyElement protected String outputSchemas
Output schemas names. This is a CSV list.
-
outputFile
@PropertyElement protected String outputFile
Write the output of the diff to a file
-
format
@PropertyElement protected String format
The format in which to display the diff output TXT or JSON
-
runOnChangeTypes
@PropertyElement protected String runOnChangeTypes
Sets runOnChange="true" for changesets containing solely changes of these types (e.g. createView, createProcedure, ...).
-
replaceIfExistsTypes
@PropertyElement protected String replaceIfExistsTypes
Sets replaceIfExists="true" for changes of the supported types, at the moment they are createView and createProcedure.
-
useOrReplaceOption
@PropertyElement protected boolean useOrReplaceOption
Flag to allow adding 'OR REPLACE' option to the create view change object when generating changelog in SQL format
-
-
Method Detail
-
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
protected void performLiquibaseTask(Liquibase liquibase) throws LiquibaseException
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
protected void printSettings(String indent)
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.MojoFailureException
Description 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.
-
-