Is there opensource/free liquibase (http://www.liquibase.org) xml generator?
Alternative to "Power Architect and Liquibase combo". Where can I create database model and then transform it to Liquibase XML format or transform pure sql to Liquibase XML?
There isn't any available generator since I know.
Actually you can do it by your own by using liquibase core classes.
An example of use:
// .. imports
// create a changelog
liquibase.changelog.DatabaseChangeLog databaseChangeLog = new liquibase.changelog.DatabaseChangeLog();
// create a changeset
liquibase.changelog.ChangeSet changeSet = new liquibase.changelog.ChangeSet("1", "prates", false, false, "", null, null, true, null, databaseChangeLog);
// create a drop table change
liquibase.change.core.DropTableChange dropTableChange = new liquibase.change.core.DropTableChange();
dropTableChange.setTableName("person");
changeSet.addChange(dropTableChange);
// add created changeset to changelog
databaseChangeLog.addChangeSet(changeSet);
// create a new serializer
XMLChangeLogSerializer xmlChangeLogSerializer = new XMLChangeLogSerializer();
String output = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
xmlChangeLogSerializer.write(databaseChangeLog.getChangeSets(), baos);
output = baos.toString();
// print output
System.out.println(output);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With