2

I have a liqubase changelog.xml. It includes few "include file" with changes. For example, base script with creating a table and another one with adding a new field to this table.

Could I get sql-script with one "create table..." statement, which include all fields. And I don't want to connect to DB. Just use liquibase xml files and jar libs.

Version liquibase - 3.5.5.

I tried to run do this command: java -jar liquibase-core-3.5.5.jar --url=offline:mssql?outputLiquibaseSql=true --changeLogFile="changelog.xml" --outputFile="all.sql" updatesql

changelog.xml:

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
    <include file="base.sql" relativeToChangelogFile="true"/>
    <include file="changelog_20180719.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

but all.sql contains only sql from first included file (base.sql)

Thanks

pevgen
  • 151
  • 2
  • 12

1 Answers1

1

You can do that, you will need to use an 'offline' connection URL. Take a look at this recent question for an example. If you are targeting a different database, the URL will be different. liquibase databasechangelog table in updateSql mode

SteveDonie
  • 8,700
  • 3
  • 43
  • 43
  • Thanks for the direction. – pevgen Sep 20 '18 at 09:16
  • But it seems that for few included files, for example: script contains tables and fields only for base.sql... – pevgen Sep 20 '18 at 11:19
  • 1
    Comments are not a great place to ask followup questions. Also, when asking questions on StackOverflow, in general it is good to include a bit more detail - the exact commands you gave, the versions of software used, the expected results, and the actual results. – SteveDonie Sep 20 '18 at 18:46
  • thanks, @stevedonie. You right. I added specific information in my question – pevgen Sep 21 '18 at 07:30