【问题标题】:Liquibase GenerateChangeLog doesnt include schemaName in the changelog fileLiquibase GenerateChangeLog 在更改日志文件中不包含 schemaName
【发布时间】:2021-10-10 19:13:04
【问题描述】:

我正在使用以下命令来生成更改日志

liquibase --schemas=test_schema --changelog-file=changelog.xml generateChangeLog

我的 liquibase.properties 文件如下:

url: jdbc:postgresql://xx.xxx.xx.xx:5432/test_db
driver: org.postgresql.Driver
username: testuser
password: test
logFile: liquibase.log
logLevel: debug
defaultSchemaName= test_schema
outputDefaultSchema= true

changelog.xml 中的输出没有 schemaName,我的数据库中有多个 schema,所以我也需要 changelog 中的 schemaname。

输出:

<changeSet author="user1 (generated)" id="xxxxxxxxxxxxx-1">
        <createTable tableName="hello_world">
            <column name="msg" type="CHAR(60)"/>
        </createTable>
    </changeSet>

应该是 test_schema.hello_world 或者应该定义 schemaname。有什么建议我做错了吗?

【问题讨论】:

    标签: liquibase liquibase-sql


    【解决方案1】:

    尝试将 currentSchema= 附加到您的数据库 url

    例如 命令行:

    --url="jdbc:postgresql://DB_HOST:DB_PORT/DB_NAME?currentSchema=SCHEMA_NAME"
    

    liquibase.properties

    url="jdbc:postgresql://DB_HOST:DB_PORT/DB_NAME?currentSchema=SCHEMA_NAME"
    

    然后调用

    liquibase <other command line params not part of liquibae.properties> generateChangeLog
    

    【讨论】:

    • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
    • 是的,我忘了更新问题,这种方法已经解决了我的问题,因此支持它:)
    【解决方案2】:

    根据这个doc--schemas=&lt;name1, name2&gt; 指定您想要包含的数据库模式。您可能想要列出要包含的模式。或者您可以简单地使用liquibase --changeLogFile=dbchangelog.xml generateChangeLog 命令。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-12
      • 2015-04-24
      • 2015-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多