简体   繁体   English

有没有办法从liquibase changelog调用我的java代码(jar,class)?

[英]Is there a way to invoke my java code (jar, class) from liquibase changelog?

I need to execute enough complex logic of data manipulation at time of database restructuring by Liquibase . 在使用Liquibase进行数据库重组时,我需要执行足够复杂的数据操作逻辑。 More precisely speaking it's need to do between two acts of data model changes. 更准确地说,需要在两次更改数据模型之间进行操作。 The data manipulation logic is performed in external java code. 数据操作逻辑在外部Java代码中执行。 There is no way to move one in SQL. 无法在SQL中移动一个。

Is there a way to invoke the external java code (jar, class) from liquibase changelog? 有没有办法从liquibase changelog调用外部Java代码(jar,class)?

The easiest way it to use a <customChange> tag referencing a class that implements liquibase.change.custom.CustomSqlChange or liquibase.change.custom.CustomTaskChange 使用<customChange>标记引用实现了liquibase.change.custom.CustomSqlChange或liquibase.change.custom.CustomTaskChange的类的最简单方法

example: 例:

    <customChange class="com.example.YourClass">
        <param name="tableName" value="table"/>
        <param name="columnName">column</param>
    </customChange>

You can implement whatever java code you want in your class. 您可以在类中实现所需的任何Java代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM