Class LiquibaseDatabaseDiff

java.lang.Object
org.apache.maven.plugin.AbstractMojo
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 Details

    • 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 the AbstractLiquibaseMojo.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
  • 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 interface org.apache.maven.plugin.Mojo
      Overrides:
      execute in class AbstractLiquibaseMojo
      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 configured Liquibase.
      Overrides:
      performLiquibaseTask in class AbstractLiquibaseChangeLogMojo
      Parameters:
      liquibase - The Liquibase 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 class AbstractLiquibaseChangeLogMojo
      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 class AbstractLiquibaseChangeLogMojo
      Throws:
      org.apache.maven.plugin.MojoFailureException - If any property that is required has not been specified.