liquibase.properties中的Liquibase changelog参数 [英] Liquibase changelog parameters in liquibase.properties

查看:684
本文介绍了liquibase.properties中的Liquibase changelog参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照文档的参数值按以下顺序查找:

As per documentation parameter values are looked up in the following order:

作为参数传递给您的Liquibase运行程序(有关如何传递它们的信息,请参阅Ant,command_line等文档)

Passed as a parameter to your Liquibase runner (see Ant, command_line, etc. documentation for how to pass them)

作为JVM系统属性

在DatabaseChangeLog文件本身的参数块(标记)中.

In the parameters block ( Tag) of the DatabaseChangeLog file itself.

我可以在标准属性文件中设置这些参数吗?

Can I set these parameters in the standard properties file?

推荐答案

可以将changelog参数放入liquibase.properties或自定义的--defaultsFile中. 阅读源文件表示您必须在属性前加上参数"..

It is possible to put changelog parameters in liquibase.properties, or a custom --defaultsFile. Reading the source indicates that you must prefix the properties with "parameter.".

您的错误可能看起来像这样:

Your error probably looks something like this:

SEVERE 11/4/16 10:26 AM: liquibase: Unknown parameter: 'read_only_user'
liquibase.exception.CommandLineParsingException: Unknown parameter: 'read_only_user'
    at liquibase.integration.commandline.Main.parsePropertiesFile(Main.java:453)

示例liquibase.properties:

Example liquibase.properties:

driver=oracle.jdbc.driver.OracleDriver
url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost)(PORT=1600))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=devdb)))"
username=scott
password=tiger
defaultSchemaName=app_admin
promptOnNonLocalDatabase=false
parameter.read_only_user=app_read

在变更集中使用参数:

<changeset author="Ryan" id="1">
  <sql>GRANT SELECT ON APP.SOME_TABLE TO ${read_only_user}</sql>
</changeset>

这篇关于liquibase.properties中的Liquibase changelog参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆