I have the following problem: I want to write data into my database once a particular changeset ran, but the manipulation should'nt be made, if the changeset did not ran. I am using the following code:
final Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(this.connection));
Liquibase liquibase = new Liquibase("myFirstChangeLog.xml", new ClassLoaderResourceAccessor(CsgApp.class.getClassLoader()), database);
liquibase.update("");
liquibase = new Liquibase(mySecondChangeLog.xml", new ClassLoaderResourceAccessor(CsgApp.class.getClassLoader()), database);
// changeExecListener
liquibase.update("");
I tried to use changeExecListener:
liquibase.setChangeExecListener(new ChangeExecListener() {
@Override
public void willRun(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, RunStatus runStatus) {
System.out.println("Will run changeset 2");
}
@Override
public void rolledBack(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database) {
// not used
}
@Override
public void ran(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, ExecType execType) {
System.out.println("Ran changeset 2");
}
});
but that wont work. Am I on the wrong way? How can I solve this problem?
Liquibase liquibase = new Liquibase("myFirstChangeLog.xml", new ClassLoaderResourceAccessor(CsgApp.class.getClassLoader()), database);
liquibase.update("");
liquibase = new Liquibase(mySecondChangeLog.xml", new ClassLoaderResourceAccessor(CsgApp.class.getClassLoader()), database);
// changeExecListener
liquibase.update("");
I tried to use changeExecListener:
liquibase.setChangeExecListener(new ChangeExecListener() {
@Override
public void willRun(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, RunStatus runStatus) {
System.out.println("Will run changeset 2");
}
@Override
public void rolledBack(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database) {
// not used
}
@Override
public void ran(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, ExecType execType) {
System.out.println("Ran changeset 2");
}
});
but that wont work. Am I on the wrong way? How can I solve this problem?