Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liquibase formatted SQL changelogs and multiple files

We are starting using liquibase for our application on the spring-boot. One of requirements use plain sql for liquibase. We have many sql files for initialization database. I check documentation https://www.liquibase.org/documentation/sql_format.html but not found information how can i create hierarchy of change log sql's files. Spring boot properties liquibase.change-log awaiting single file. I tried to separate file names by , or ; all times got error from spring-boot Cannot find changelog location... So my question:
How can i declare execution of another file or files in "sql format"??
Like xml equivalent:
<include file="second_changelog.sql"/>
<include file="third_changelog.sql"/>


Not worked example first_changelog.sql :
--liquibase formatted sql --changeset author_1:1 UPDATE [dbo].[customers] SET name='HD_1' WHERE id = '11'; --import file=second_changelog.sql --import file=third_changelog.sql

PS. Please do not suggest xml, because of i need only SQL

like image 505
borino Avatar asked Oct 27 '25 18:10

borino


1 Answers

You can use one XML file which contains multiple references to plain sql (see for details https://www.liquibase.org/documentation/changes/sql_file.html)

Example:

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd">

    <changeSet id="init" author="author">
        <sqlFile encoding="utf8" path="first_changelog.sql"/>
        <sqlFile encoding="utf8" path="second_changelog.sql"/>
    </changeSet>
like image 141
Yuriy Alevohin Avatar answered Oct 29 '25 07:10

Yuriy Alevohin