From cdac97120a9db79aec6d0e9f7610b035319602d6 Mon Sep 17 00:00:00 2001 From: Thomas Schroeter Date: Fri, 8 Feb 2019 16:30:02 +0000 Subject: [PATCH] [CORDA-2547] Migrate table of SimpleNotaryService (#4722) * CORDA-2547: WIP Migrate old notary schema correctly. Modify liquibase scripts to rename the old committed state table instead of creating a new one. * Rename liquibase change sets * Change 3.3 baseline before Liquibase. * Aligin with ENT, orginal node-notary.changelog-v1.xml moved to node-notary.changelog-v2.xml and it's compatible with ENT (which already has changes from v2). * Aligin with ENT, orginal node-notary.changelog-v1.xml moved to node-notary.changelog-v2.xml and it's compatible with ENT (which already has changes from v2) - adding v2 to master file. * Ensure setting up Liquibase on pre-existing pre-Liquibase database --- .../internal/persistence/SchemaMigration.kt | 4 ++ .../migration/node-core.changelog-master.xml | 3 +- .../migration/node-notary.changelog-init.xml | 2 +- .../node-notary.changelog-master.xml | 2 +- .../migration/node-notary.changelog-v2.xml | 37 +++++++++++++++++++ .../vault-schema.changelog-master.xml | 3 +- .../migration/vault-schema.changelog-v7.xml | 2 +- 7 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 node/src/main/resources/migration/node-notary.changelog-v2.xml diff --git a/node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/SchemaMigration.kt b/node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/SchemaMigration.kt index 7083aafdc6..be1470b445 100644 --- a/node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/SchemaMigration.kt +++ b/node-api/src/main/kotlin/net/corda/nodeapi/internal/persistence/SchemaMigration.kt @@ -169,6 +169,10 @@ class SchemaMigration( if (schemas.any { schema -> schema.migrationResource == "notary-raft.changelog-master" }) preV4Baseline.addAll(listOf("migration/notary-raft.changelog-init.xml", "migration/notary-raft.changelog-v1.xml")) + + if (schemas.any { schema -> schema.migrationResource == "notary-bft-smart.changelog-master" }) + preV4Baseline.addAll(listOf("migration/notary-bft-smart.changelog-init.xml", + "migration/notary-bft-smart.changelog-v1.xml")) } if (isFinanceAppWithLiquibaseNotMigrated) { preV4Baseline.addAll(listOf("migration/cash.changelog-init.xml", diff --git a/node/src/main/resources/migration/node-core.changelog-master.xml b/node/src/main/resources/migration/node-core.changelog-master.xml index bb852326c2..d675e84c88 100644 --- a/node/src/main/resources/migration/node-core.changelog-master.xml +++ b/node/src/main/resources/migration/node-core.changelog-master.xml @@ -1,8 +1,7 @@ + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> diff --git a/node/src/main/resources/migration/node-notary.changelog-init.xml b/node/src/main/resources/migration/node-notary.changelog-init.xml index 7bb5a20c52..77f918bb92 100644 --- a/node/src/main/resources/migration/node-notary.changelog-init.xml +++ b/node/src/main/resources/migration/node-notary.changelog-init.xml @@ -44,4 +44,4 @@ - \ No newline at end of file + diff --git a/node/src/main/resources/migration/node-notary.changelog-master.xml b/node/src/main/resources/migration/node-notary.changelog-master.xml index 6ebd2c54ce..d8a5a61b8c 100644 --- a/node/src/main/resources/migration/node-notary.changelog-master.xml +++ b/node/src/main/resources/migration/node-notary.changelog-master.xml @@ -5,8 +5,8 @@ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> - + diff --git a/node/src/main/resources/migration/node-notary.changelog-v2.xml b/node/src/main/resources/migration/node-notary.changelog-v2.xml new file mode 100644 index 0000000000..4c2adec29d --- /dev/null +++ b/node/src/main/resources/migration/node-notary.changelog-v2.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/node/src/main/resources/migration/vault-schema.changelog-master.xml b/node/src/main/resources/migration/vault-schema.changelog-master.xml index 3fd168bea7..e934760df8 100644 --- a/node/src/main/resources/migration/vault-schema.changelog-master.xml +++ b/node/src/main/resources/migration/vault-schema.changelog-master.xml @@ -1,8 +1,7 @@ + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> diff --git a/node/src/main/resources/migration/vault-schema.changelog-v7.xml b/node/src/main/resources/migration/vault-schema.changelog-v7.xml index 5b85396391..ba5e86e127 100644 --- a/node/src/main/resources/migration/vault-schema.changelog-v7.xml +++ b/node/src/main/resources/migration/vault-schema.changelog-v7.xml @@ -5,4 +5,4 @@ - + \ No newline at end of file