Hi Steinar,

Some pseudo-code :

JdbcConnection connection = new JdbcConnection(myConnection);
Database database =
DatabaseFactory.getInstance().findCorrectDatabaseImplementation(connection);
ChangeLogParameters changeLogParameters = new ChangeLogParameters(database);

String liquibaseFilePath = "OSGI-INF/liquibase/master.xml";
ResourceAccessor resourceAccessor = new OSGiResourceAccessor(myBundle);
DatabaseChangeLog databaseChangeLog = ChangeLogParserFactory.getInstance()
                .getParser(liquibaseFilePath, resourceAccessor)
                .parse(liquibaseFilePath, changeLogParameters,
resourceAccessor);


for (final ChangeSet changeSet : databaseChangeLog.getChangeSets()) {
  if (database.getRanChangeSet(changeSet) == null) {
    changeSet.execute(databaseChangeLog, database);
    database.markChangeSetExecStatus(changeSet,
ChangeSet.ExecType.EXECUTED);
  }
}

I'm sure there are better ways nowadays, but this is how we got it to work
so many years ago.

Steven

On Wed, Aug 3, 2022 at 3:25 PM Steinar Bang <s...@dod.no> wrote:

> >>>>> Steinar Bang <s...@dod.no>:
> >>>>> Steven Huypens <steven.huyp...@gmail.com>:
>
> >> I had a brief look at your repo and I see you are creating an actual
> >> Liquibase instance, which we are not, possibly because of certain
> >> issues in the past. But I don't think that should make a difference
> >> wrt logging.
>
> > No, I don't think that should make a difference either.
>
> Actually, this could make a big difference, because I think how I'm
> creating the Liquibase instance and the resource locator I'm using,
> could effect the log-finding problems I'm seeing.
>
> I'm curious: if you're not creating an actual Liquibase instance, how do
> you use liquibase?
>
> (I'm using Liquibase the only way I was able to figure out it could be
> used, back when I started using liquibse in 2017, and if there is a
> different and better way, I'm open to that)
>
> Thanks!
>
>

Reply via email to