mirror of
https://github.com/corda/corda.git
synced 2025-05-31 14:40:52 +00:00
CORDA-3302: Align OS + Ent SchemaMigration parameters (#5622)
* Rename SchemaMigrationTest and make ourName parameter nullable to remove enterprise conflicts * Fix detekt baseline * Further alignment * Update detekt
This commit is contained in:
parent
6493ffefef
commit
6e43bc1db6
@ -3219,7 +3219,7 @@
|
|||||||
<ID>MaxLineLength:SchemaMigration.kt$MissingMigrationException.Companion$fun errorMessageFor(mappedSchema: MappedSchema): String</ID>
|
<ID>MaxLineLength:SchemaMigration.kt$MissingMigrationException.Companion$fun errorMessageFor(mappedSchema: MappedSchema): String</ID>
|
||||||
<ID>MaxLineLength:SchemaMigration.kt$OutstandingDatabaseChangesException : DatabaseMigrationException</ID>
|
<ID>MaxLineLength:SchemaMigration.kt$OutstandingDatabaseChangesException : DatabaseMigrationException</ID>
|
||||||
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$ private fun migrateOlderDatabaseToUseLiquibase(existingCheckpoints: Boolean): Boolean</ID>
|
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$ private fun migrateOlderDatabaseToUseLiquibase(existingCheckpoints: Boolean): Boolean</ID>
|
||||||
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$( val schemas: Set<MappedSchema>, val dataSource: DataSource, private val databaseConfig: DatabaseConfig, cordappLoader: CordappLoader? = null, private val currentDirectory: Path?, // This parameter is used by the vault state migration to establish what the node's legal identity is when setting up // its copy of the identity service. It is passed through using a system property. When multiple identity support is added, this will need // reworking so that multiple identities can be passed to the migration. private val ourName: CordaX500Name, // This parameter forces an error to be thrown if there are missing migrations. When using H2, Hibernate will automatically create schemas where they are // missing, so no need to throw unless you're specifically testing whether all the migrations are present. private val forceThrowOnMissingMigration: Boolean = false)</ID>
|
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$( val schemas: Set<MappedSchema>, val dataSource: DataSource, private val databaseConfig: DatabaseConfig, cordappLoader: CordappLoader? = null, private val currentDirectory: Path?, // This parameter is used by the vault state migration to establish what the node's legal identity is when setting up // its copy of the identity service. It is passed through using a system property. When multiple identity support is added, this will need // reworking so that multiple identities can be passed to the migration. private val ourName: CordaX500Name? = null, // This parameter forces an error to be thrown if there are missing migrations. When using H2, Hibernate will automatically create schemas where they are // missing, so no need to throw unless you're specifically testing whether all the migrations are present. private val forceThrowOnMissingMigration: Boolean = false)</ID>
|
||||||
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$(mappedSchema::class.qualifiedName == "net.corda.finance.schemas.CashSchemaV1" || mappedSchema::class.qualifiedName == "net.corda.finance.schemas.CommercialPaperSchemaV1") && mappedSchema.migrationResource == null -> null</ID>
|
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$(mappedSchema::class.qualifiedName == "net.corda.finance.schemas.CashSchemaV1" || mappedSchema::class.qualifiedName == "net.corda.finance.schemas.CommercialPaperSchemaV1") && mappedSchema.migrationResource == null -> null</ID>
|
||||||
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$(run && !check) && (unRunChanges.isNotEmpty() && existingCheckpoints!!) -> throw CheckpointsException()</ID>
|
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$(run && !check) && (unRunChanges.isNotEmpty() && existingCheckpoints!!) -> throw CheckpointsException()</ID>
|
||||||
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$System.setProperty(NODE_BASE_DIR_KEY, path)</ID>
|
<ID>MaxLineLength:SchemaMigration.kt$SchemaMigration$System.setProperty(NODE_BASE_DIR_KEY, path)</ID>
|
||||||
|
@ -31,7 +31,7 @@ class SchemaMigration(
|
|||||||
// This parameter is used by the vault state migration to establish what the node's legal identity is when setting up
|
// This parameter is used by the vault state migration to establish what the node's legal identity is when setting up
|
||||||
// its copy of the identity service. It is passed through using a system property. When multiple identity support is added, this will need
|
// its copy of the identity service. It is passed through using a system property. When multiple identity support is added, this will need
|
||||||
// reworking so that multiple identities can be passed to the migration.
|
// reworking so that multiple identities can be passed to the migration.
|
||||||
private val ourName: CordaX500Name,
|
private val ourName: CordaX500Name? = null,
|
||||||
// This parameter forces an error to be thrown if there are missing migrations. When using H2, Hibernate will automatically create schemas where they are
|
// This parameter forces an error to be thrown if there are missing migrations. When using H2, Hibernate will automatically create schemas where they are
|
||||||
// missing, so no need to throw unless you're specifically testing whether all the migrations are present.
|
// missing, so no need to throw unless you're specifically testing whether all the migrations are present.
|
||||||
private val forceThrowOnMissingMigration: Boolean = false) {
|
private val forceThrowOnMissingMigration: Boolean = false) {
|
||||||
@ -99,7 +99,11 @@ class SchemaMigration(
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doRunMigration(run: Boolean, check: Boolean, existingCheckpoints: Boolean? = null) {
|
private fun doRunMigration(
|
||||||
|
run: Boolean,
|
||||||
|
check: Boolean,
|
||||||
|
existingCheckpoints: Boolean? = null
|
||||||
|
) {
|
||||||
|
|
||||||
// Virtual file name of the changelog that includes all schemas.
|
// Virtual file name of the changelog that includes all schemas.
|
||||||
val dynamicInclude = "master.changelog.json"
|
val dynamicInclude = "master.changelog.json"
|
||||||
@ -121,7 +125,9 @@ class SchemaMigration(
|
|||||||
if (path != null) {
|
if (path != null) {
|
||||||
System.setProperty(NODE_BASE_DIR_KEY, path) // base dir for any custom change set which may need to load a file (currently AttachmentVersionNumberMigration)
|
System.setProperty(NODE_BASE_DIR_KEY, path) // base dir for any custom change set which may need to load a file (currently AttachmentVersionNumberMigration)
|
||||||
}
|
}
|
||||||
|
if (ourName != null) {
|
||||||
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)
|
checkResourcesInClassPath(changelogList)
|
||||||
|
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package net.corda.nodeapi.internal
|
package net.corda.nodeapi.internal.persistence
|
||||||
|
|
||||||
import net.corda.core.schemas.MappedSchema
|
import net.corda.core.schemas.MappedSchema
|
||||||
import net.corda.core.schemas.PersistentState
|
import net.corda.core.schemas.PersistentState
|
||||||
import net.corda.node.internal.DataSourceFactory
|
import net.corda.node.internal.DataSourceFactory
|
||||||
import net.corda.node.services.persistence.DBCheckpointStorage
|
import net.corda.node.services.persistence.DBCheckpointStorage
|
||||||
import net.corda.node.services.schema.NodeSchemaService
|
import net.corda.node.services.schema.NodeSchemaService
|
||||||
import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
|
||||||
import net.corda.nodeapi.internal.persistence.MissingMigrationException
|
|
||||||
import net.corda.nodeapi.internal.persistence.SchemaMigration
|
|
||||||
import net.corda.testing.core.ALICE_NAME
|
import net.corda.testing.core.ALICE_NAME
|
||||||
import net.corda.testing.core.TestIdentity
|
import net.corda.testing.core.TestIdentity
|
||||||
import net.corda.testing.node.MockServices
|
import net.corda.testing.node.MockServices
|
||||||
@ -20,7 +17,7 @@ import javax.persistence.Column
|
|||||||
import javax.persistence.Entity
|
import javax.persistence.Entity
|
||||||
import javax.sql.DataSource
|
import javax.sql.DataSource
|
||||||
|
|
||||||
class SchemaMigrationTest {
|
class MissingSchemaMigrationTest {
|
||||||
object TestSchemaFamily
|
object TestSchemaFamily
|
||||||
|
|
||||||
object GoodSchema : MappedSchema(schemaFamily = TestSchemaFamily.javaClass, version = 1, mappedTypes = listOf(State::class.java)) {
|
object GoodSchema : MappedSchema(schemaFamily = TestSchemaFamily.javaClass, version = 1, mappedTypes = listOf(State::class.java)) {
|
Loading…
x
Reference in New Issue
Block a user