0

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

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。有什么建议我做错了吗?

4

2 回答 2

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
于 2021-10-27T20:02:40.253 回答
0

According to this doc, the --schemas=<name1, name2> specifies database schemas you want to include. You might want to list out the schemas you want to include. Or you can simply use the liquibase --changeLogFile=dbchangelog.xml generateChangeLog command.

于 2021-08-13T13:50:35.770 回答