【问题标题】:Unexpected error running Liquibase: ERROR: relation "databasechangelog" does not exist运行 Liquibase 时出现意外错误:错误:关系“databasechangelog”不存在
【发布时间】:2017-06-25 04:47:14
【问题描述】:

在对新的 postgres 数据库运行 liquibase(3.5.3 版)部署时,我们收到以下错误。 liquibase 没有创建表 databasechangelog,但确实创建了表 databasechangeloglock。

INFO 2/7/17 1:27 PM: liquibase: Successfully acquired change log lock
INFO 2/7/17 1:27 PM: liquibase: Successfully released change log lock
Unexpected error running Liquibase: ERROR: relation "audit.databasechangelog" does not exist
  Position: 20

 SEVERE 2/7/17 1:27 PM: liquibase: ERROR: relation "audit.databasechangelog" does
    not exist
      Position: 20
liquibase.exception.DatabaseException: Error executing SQL SELECT MD5SUM FROM au
dit.databasechangelog WHERE MD5SUM IS NOT NULL LIMIT 1: ERROR: relation "audit.d
atabasechangelog" does not exist
  Position: 20
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:68)
        at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:126)
        at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:134)
        at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:20
0)
        at liquibase.executor.jvm.JdbcExecutor.queryForList(JdbcExecutor.java:19
4)
        at liquibase.changelog.StandardChangeLogHistoryService.init(StandardChan
geLogHistoryService.java:212)
        at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1124)
        at liquibase.Liquibase.update(Liquibase.java:205)
        at liquibase.Liquibase.update(Liquibase.java:192)
        at liquibase.integration.commandline.Main.doMigration(Main.java:1130)
        at liquibase.integration.commandline.Main.run(Main.java:188)
        at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "audit.databasecha
ngelog" does not exist
  Position: 20
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryEx
ecutorImpl.java:2455)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutor
Impl.java:2155)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.ja
va:288)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)

        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303
)
        at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289
)
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266
)
        at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:233)
        at liquibase.executor.jvm.JdbcExecutor$QueryStatementCallback.doInStatem
ent(JdbcExecutor.java:345)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
        ... 11 more

有两种模式,ods 和 audit。并且 search_path 是 ods、audit、public。我们在连接字符串中指定目标模式 (currentSchema=audit)。此外,我们成功地针对 ods 模式运行。 作为一种解决方法,我们可以手动创建日志表。但是,我想知道这是 liquibase 的错误还是我们做错了什么?我的想法是 liquibase 以某种方式看到 ods.databasechangelog 并跳过创建它。

任何想法都将不胜感激。

【问题讨论】:

    标签: liquibase


    【解决方案1】:

    也许尝试使用以下 liquibase 参数: --defaultSchemaName=<schema>

    【讨论】:

    • “也许”和“尝试”不是应该在 SO 的答案中出现的词。专注于您可以编写完整解决方案的问题,您知道这些问题可以解决提问者的问题。获得 50 个代表后,您可以使用 cmets 要求澄清或提出建议。
    猜你喜欢
    • 2014-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-23
    • 2022-06-26
    • 1970-01-01
    • 2022-01-21
    相关资源
    最近更新 更多