运行Liquibase时出现意外错误:ERROR:relation" databasechangelog"不存在

时间:2017-02-07 19:31:15

标签: liquibase

当针对新的postgres数据库运行liquibase(版本3.5.3)部署时,我们收到以下错误。表,databasechangelog没有由liquibase创建,但是表database databaseloglock确实已经创建了。

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

任何想法都会受到赞赏。

1 个答案:

答案 0 :(得分:0)

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