liquibase diff和diffChangeLog有什么区别?如何为diffChangeLog运行maven命令?

时间:2019-04-03 05:32:20

标签: spring jpa liquibase

我是Liquibase的新手,我了解到diffdiffChangeLog这两种模式在相反的方向上使用目标数据库和基准(参考)数据库。

Using "diff" will show the difference going from 'base (reference)' -> 'target' which makes sense.
While "diffChangeLog" outputs the difference going from 'target' to 'base (reference)'.

我执行了Maven目标liquibase:diffChangeLog,但遇到以下错误

[ERROR] Could not find goal 'diffChangeLog' in plugin 
org.liquibase:liquibase-maven-plugin:3.5.1 among available goals dropAll, 
rollback, clearCheckSums, updateTestingRollback, changelogSync, updateSQL, 
migrateSQL, generateChangeLog, dbDoc, status, listLocks, changelogSyncSQL, 
releaseLocks, migrate, tag, diff, rollbackSQL, futureRollbackSQL, update, 
help -> [Help 1]

我做错了什么?我该如何以liquibase:diffChangeLog身份运行Maven?

1 个答案:

答案 0 :(得分:0)

diffliquibase:diff)是用于查找数据库状态之间差异的maven goal

diffChangeLogcommand line的参数,用于使用Liquibase进行command line tool操作。没有称为liquibase:diffChangeLog

的目标

内部代码如下

    if ("diff".equalsIgnoreCase(this.command)) {
    CommandLineUtils.doDiff(createReferenceDatabaseFromCommandParams(this.commandParams, fileOpener), database, StringUtils.trimToNull(this.diffTypes), finalSchemaComparisons);
  }
  else if ("diffChangeLog".equalsIgnoreCase(this.command)) {
    CommandLineUtils.doDiffToChangeLog(this.changeLogFile, createReferenceDatabaseFromCommandParams(this.commandParams, fileOpener), database, diffOutputControl, StringUtils.trimToNull(this.diffTypes), finalSchemaComparisons);
  }