简体   繁体   中英

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 . 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. There is no way to move one in SQL.

Is there a way to invoke the external java code (jar, class) from liquibase changelog?

The easiest way it to use a <customChange> tag referencing a class that implements liquibase.change.custom.CustomSqlChange or 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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