Liquibase using Java

Thanks

That is quite a list of questions.  I’d be interested in hearing the backstory behind those questions.  My guess is that you want to use liquibase to handle your ddl but you don’t want liquibase to track those changes. Speaking as a Liquibase user, I wouldn’t recommmend using liquibase if you don’t want to track in each database instance which changes have been applied and which ones haven’t.

 

In any case in Liquibase 2 (and i’m sure liquibase 3) you can create a changeset programatically.  The following is a very rudimentary example.

 

DatabaseChangeLog cl = new DatabaseChangeLog();
ChangeSet cs = new ChangeSet(“id1”, “author”, false, false, “java-source”, null, null);
cl.addChangeSet(cs);
CreateTableChange tbl = new CreateTableChange();
cs.addChange(tbl);
tbl.addColumn(new ColumnConfig().setType(“varchar(3)”));

 

The one missing piece in version 2 is that you would need to add a signature to

 

liquibase.Liquibase.update(int, String)

 

liquibase.Liquibase.update(int, String, DatabaseChangeLog)

 

Again, these suggestions are being made by a user who has very little understanding of the internals of liquibase.  I encourage you to post your use case to get a more intersting response.