mirror of
https://github.com/corda/corda.git
synced 2025-06-14 21:28:14 +00:00
This reverts commit 87720163
This commit is contained in:
@ -13,6 +13,7 @@ import net.corda.nodeapi.internal.MigrationHelpers.getMigrationResource
|
|||||||
import net.corda.core.schemas.MappedSchema
|
import net.corda.core.schemas.MappedSchema
|
||||||
import net.corda.core.utilities.contextLogger
|
import net.corda.core.utilities.contextLogger
|
||||||
import net.corda.nodeapi.internal.cordapp.CordappLoader
|
import net.corda.nodeapi.internal.cordapp.CordappLoader
|
||||||
|
import sun.security.x509.X500Name
|
||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
@ -114,7 +115,6 @@ class SchemaMigration(
|
|||||||
}
|
}
|
||||||
System.setProperty(NODE_X500_NAME, ourName.toString())
|
System.setProperty(NODE_X500_NAME, ourName.toString())
|
||||||
val customResourceAccessor = CustomResourceAccessor(dynamicInclude, changelogList, classLoader)
|
val customResourceAccessor = CustomResourceAccessor(dynamicInclude, changelogList, classLoader)
|
||||||
checkResourcesInClassPath(changelogList)
|
|
||||||
|
|
||||||
// current version of Liquibase appears to be non-threadsafe
|
// current version of Liquibase appears to be non-threadsafe
|
||||||
// this is apparent when multiple in-process nodes are all running migrations simultaneously
|
// this is apparent when multiple in-process nodes are all running migrations simultaneously
|
||||||
@ -209,7 +209,6 @@ class SchemaMigration(
|
|||||||
|
|
||||||
if (preV4Baseline.isNotEmpty()) {
|
if (preV4Baseline.isNotEmpty()) {
|
||||||
val dynamicInclude = "master.changelog.json" // Virtual file name of the changelog that includes all schemas.
|
val dynamicInclude = "master.changelog.json" // Virtual file name of the changelog that includes all schemas.
|
||||||
checkResourcesInClassPath(preV4Baseline)
|
|
||||||
dataSource.connection.use { connection ->
|
dataSource.connection.use { connection ->
|
||||||
val customResourceAccessor = CustomResourceAccessor(dynamicInclude, preV4Baseline, classLoader)
|
val customResourceAccessor = CustomResourceAccessor(dynamicInclude, preV4Baseline, classLoader)
|
||||||
val liquibase = Liquibase(dynamicInclude, customResourceAccessor, getLiquibaseDatabase(JdbcConnection(connection)))
|
val liquibase = Liquibase(dynamicInclude, customResourceAccessor, getLiquibaseDatabase(JdbcConnection(connection)))
|
||||||
@ -218,14 +217,6 @@ class SchemaMigration(
|
|||||||
}
|
}
|
||||||
return isExistingDBWithoutLiquibase || isFinanceAppWithLiquibaseNotMigrated
|
return isExistingDBWithoutLiquibase || isFinanceAppWithLiquibaseNotMigrated
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkResourcesInClassPath(resources: List<String?>) {
|
|
||||||
for (resource in resources) {
|
|
||||||
if (classLoader.getResource(resource) == null) {
|
|
||||||
throw DatabaseMigrationException("Could not find Liquibase database migration script $resource. Please ensure the jar file containing it is deployed in the cordapps directory.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open class DatabaseMigrationException(message: String) : IllegalArgumentException(message) {
|
open class DatabaseMigrationException(message: String) : IllegalArgumentException(message) {
|
||||||
|
Reference in New Issue
Block a user