Skip to content

Commit

Permalink
[#9866] Liquibase imports should use ClassLoaderResourceAccessor
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaseder committed Feb 25, 2020
1 parent 5de3cfd commit 41a64fc
Showing 1 changed file with 14 additions and 1 deletion.
Expand Up @@ -58,6 +58,8 @@
import liquibase.database.Database;
import liquibase.database.DatabaseFactory;
import liquibase.database.jvm.JdbcConnection;
import liquibase.resource.ClassLoaderResourceAccessor;
import liquibase.resource.CompositeResourceAccessor;
import liquibase.resource.FileSystemResourceAccessor;

/**
Expand Down Expand Up @@ -135,11 +137,22 @@ else if (key.startsWith("changeLogParameters.")) {
contexts = "" + entry.getValue();
}
}

// Retrieve changeLog table names as they might be overridden by configuration setters
databaseChangeLogTableName = database.getDatabaseChangeLogTableName();
databaseChangeLogLockTableName = database.getDatabaseChangeLogLockTableName();

Liquibase liquibase = new Liquibase(scripts, new FileSystemResourceAccessor(), database);
// [#9866] Allow for loading included files from the classpath or using absolute paths.
Liquibase liquibase = new Liquibase(
scripts,
new CompositeResourceAccessor(
new FileSystemResourceAccessor(),
new ClassLoaderResourceAccessor(),
new ClassLoaderResourceAccessor(Thread.currentThread().getContextClassLoader())
),
database
);

liquibase.update(contexts);
}

Expand Down

0 comments on commit 41a64fc

Please sign in to comment.