mirror of
https://github.com/corda/corda.git
synced 2025-06-16 14:18:20 +00:00
Fix null migration resource (#210)
throw exception when migration not set for MappedSchema
This commit is contained in:
@ -28,18 +28,18 @@ class SchemaMigration(val schemas: Set<MappedSchema>, val dataSource: DataSource
|
||||
|
||||
dataSource.connection.use { connection ->
|
||||
|
||||
//collect all changelog file referenced in the included schemas
|
||||
val changelogList = schemas.map { mappedSchema ->
|
||||
getMigrationResource(mappedSchema).let {
|
||||
"${MIGRATION_PREFIX}/${it}.xml"
|
||||
}
|
||||
}
|
||||
|
||||
//create a resourse accessor that aggregates the changelogs included in the schemas into one dynamic stream
|
||||
val customResourceAccessor = object : ClassLoaderResourceAccessor() {
|
||||
override fun getResourcesAsStream(path: String): Set<InputStream> {
|
||||
|
||||
if (path == dynamicInclude) {
|
||||
//collect all changelog file referenced in the included schemas
|
||||
val changelogList = schemas.map { mappedSchema ->
|
||||
getMigrationResource(mappedSchema).let {
|
||||
"${MIGRATION_PREFIX}/${it}.xml"
|
||||
}
|
||||
}
|
||||
|
||||
//create a map in liquibase format including all migration files
|
||||
val includeAllFiles = mapOf("databaseChangeLog" to changelogList.map { file -> mapOf("include" to mapOf("file" to file)) })
|
||||
|
||||
|
Reference in New Issue
Block a user