Convert changeLog XML-File into SQL-File

Hello Community,

is it possible to convert a ChangeLog-File into SQL using liquibase or create a SQL-File using the diff-command

I compared two databases using the diff-command and got a ChangeLog-File (XML). I searched the web for a possibility to convert, but found nothing.

Do i miss some parameter something like updateSQL or rollbackSQl to create SQL for the diff-command?

I tried something like

        liquibase --changeLogFile=~/change.xml updateSQL
  to convert
but get an error like

    Errors: --url is required
Therefore i decided it is not the right command for me :-)

Regards,
Frank

I am no expert, so take my advice with that in mind

Almost every liquibase command needs connection parameters to connect to a database. If you run the command

    liquibase --help

you will see that the following parameters are required.

    Required Parameters: --changeLogFile=        Migration file --username=                        Database username --password=                        Database password --url=                              Database URL

Did you provide these parameters when executing the command?

(Tip) In order not to safe some time it is possible to put the connection information in a file named “liquibase.properties” and it will get picked up. for example:

    username=developer password=s3cr3t url=jdbc:postgresql://localhost:5432/test driver=org.postgresql.Driver changeLogFile=changelog.xml

Hello,

thank you for your reply.

Yes, i was connected with the database when I created the XML-Changelog.
This worked fine, but my need is to find a way to convert a XML to SQL,
but I don�t see, why it should be necessary to be connected to a DB when
converting a File :slight_smile: But I will try this nevertheless.

Regards,

Frank 

I tried to pass the connection along with the command, but it does’nt worked.

There must be a way to get SQL :slight_smile:

You do need to have a database to connect to for updateSQL because liquibase will generate different SQL based on the database type. 

What is the command line you are using and the error you get?

Nathan