how to specify output format other than XML for liquibase command line tool?
e.g. I want to use SQL or JSON as an output.
it seems that http://www.liquibase.org/documentation/command_line.html is missing this parameter?
Thanks in advance for response, and MANY MANY THANKS for developers for the great application!
You are talking about the generateChangeLog or diffChangeLog command, right?
It should chose the correct type based on the file extension, so you can use .json or .yaml. There isn’t support to generate an sql-based changelog at this point.
When I try to create .json and .yaml files it generates the files but they are empty. I’m using the same command that generates an .xml file just changing the extension.
liquibase --driver=org.postgresql.Driver --changeLogFile=db.changelog.yaml --url=“jdbc:postgresql://192.168.1.94:5432/postgres” --username=user --password=password --defaultSchemaName=ADMIN generateChangeLog
One thing I notice is when I run liquibase --version I get Liquibase Version: 3.0.0-SNAPSHOT even though I downloaded both
Good to hear Liquibase is working well for you.
Yes, if you use the formatted sql style, liquibase will just execute the sql listed.
The trouble with generating actual SQL as the output is that it is going to vary depending on the target database. Normally to add support for a new output format you need to add a new ChangeLogSerializer implementation and then override the needed methods. They are just passed the Changes needed to “fix” the database but no Database reference. You should be able, though, as part of the serialize method call the SqlGeneratorFactory with the passed Change and a mock Database instance to get the actual SQL and return that from the serialize method.
I would guess it would maybe take a day or so to get figured out.
Thank you for the fast reply and for the product Nathan.
Am I right that the SQL commands in a change log written in SQL format will be executed as is?
How many developer hours do u think are needed to implement exporting in SQL format?
With many… many… thanks for the great application and support,
Shoot. Apparently the json/yaml specific methods to actually write the changesets did not make it into 3.0. I created https://liquibase.jira.com/browse/CORE-1404 to track the fix.