ENT-8826 Upgrade Liquibase to latest version - more review feedback (#7279)

This commit is contained in:
Mahmoud Almahroum 2023-03-10 14:28:40 +00:00 committed by GitHub
parent 1a0d354903
commit 021c70143b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -154,25 +154,23 @@ open class SchemaMigration(
if (path == dynamicInclude) { if (path == dynamicInclude) {
// Return the json as a stream. // Return the json as a stream.
val inputStream = getPathAsStream()
val resource = object : URIResource(path, URI(path)) { val resource = object : URIResource(path, URI(path)) {
override fun openInputStream(): InputStream { override fun openInputStream(): InputStream {
return inputStream return getPathAsStream()
} }
} }
return Collections.singletonList(resource) return Collections.singletonList(resource)
} }
// Take 1 resource due to LiquidBase find duplicate files which throws an error // Take 1 resource due to Liquibase find duplicate files which throws an error
return super.getAll(path).take(1) return super.getAll(path).take(1)
} }
override fun get(path: String?): Resource { override fun get(path: String?): Resource {
if (path == dynamicInclude) { if (path == dynamicInclude) {
// Return the json as a stream. // Return the json as a stream.
val inputStream = getPathAsStream()
return object : URIResource(path, URI(path)) { return object : URIResource(path, URI(path)) {
override fun openInputStream(): InputStream { override fun openInputStream(): InputStream {
return inputStream return getPathAsStream()
} }
} }
} }

View File

@ -86,7 +86,7 @@ class IdenityServiceKeyRotationMigrationTest {
Liquibase("migration/node-core.changelog-v20.xml", object : ClassLoaderResourceAccessor() { Liquibase("migration/node-core.changelog-v20.xml", object : ClassLoaderResourceAccessor() {
override fun getAll(path: String?): List<Resource> { override fun getAll(path: String?): List<Resource> {
return super.getAll(path).take(1).toList() return if(path != null) super.getAll(path).take(1).toList() else emptyList()
} }
}, liquibaseDB).update(Contexts().toString()) }, liquibaseDB).update(Contexts().toString())