Upgrading a Corda OS Node to Corda Enterprise
A Corda (open source) node can be upgraded to Corda Enterprise. If the same database is to be reused, the most complicated steps are ensuring custom CorDapps contain Liquibase database management scripts and adding these scripts into the database change log table.
The migration from an H2 database to a 3rd party commercial database, while upgrading to Corda Enteprise, requires a third party tool to migrate data.
Upgrade from Corda (open source) to Corda Enterprise
To upgrade Corda (open source) to Corda Enterprise within the same major release version, follow the Corda node upgrade procedure. The database upgrade steps need to be replaced by those specified below, depending if you are reusing an existing database or Migrating from the H2 database to another database vendor.
Reusing an existing database
Ensure CorDapps contain Liquibase database management scripts. You can check if the CorDapp JAR contains Liquibase scripts as described in Database update. If the Cordapp stores data in the custom tables (consult with the CorDapp developer/provider) and it doesn’t contain Liquibase scripts, follow the procedure to add the script retrospectively.Adding a Liquibase migration script to a CorDapp should be done by a CorDapp developer.
Generate CorDapp changesets against an empty database.Any custom tables required by CorDapps will have been created manually or by Hibernate upon node startup. Because of this, the database doesn’t contain an entry in the DATABASECHANGELOG table (usually created by the Liquibase runner). This step aims to add the required log as if these tables were created by Liquibase.First, you need to run Corda Database Management Tool to obtain DDL statements created by Liquibase. You should run the tool against an empty database, not the database you are reusing.To run the tool use the following command:
java -jar tools-database-manager-|release|.jar dry-run -b path_to_configuration_directory
-b points to the base directory (the directory containing a
node.conf file, and the drivers and cordapps subdirectories). The generated script (migration/.sql*) will be present in the base directory.
This script contains all of the statements to create the data structures (e.g. tables/indexes) for CorDapps,
and inserts to the Liquibase management table *DATABASECHANGELOG*.
For a description of the options, refer to the
Corda Database Management Tool manual.
- Run selected insert statements to update Liquibase database change logIn the generated script, find all inserts into DATABASECHANGELOG table related to your CorDapp,
you can search for – Changeset migration/
lines, where references the Liquibase Script file name from the CorDapp. The SQL insert related to a changeset will follow the – Changeset migration/ comment, for example:
-- Changeset migration/yo-schema-v1.changelog-master.sql::initial_schema_for_YoSchemaV1::R3.Corda.Generated INSERT INTO PUBLIC.DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('initial_schema_for_YoSchemaV1', 'R3.Corda.Generated', 'migration/yo-schema-v1.changelog-master.sql', NOW(), 74, '7:2d4e1d5d7165a8edc848208d0707eb24', 'sql', '', 'EXECUTED', NULL, NULL, '3.5.3', '2862877878');
Copy selected insert statements and execute them on the database, using the correct schema name.
Migrating from the H2 database to another database vendor
- Create a database schema and configure a Corda node to connect to the new database following Database schema setup instructions for a production system, or Simplified database schema setup for development instructions for development/testing purposes. Refer to Understanding the node database to decide which setup is more suitable.
- Migrate data from H2 databaseThe migration from the H2 database requires a third party specialized tool. Your organisation may need to purchase a licence to use the tool. Please contact R3 for further advice.
- Follow the same CorDapp database upgrade steps (1-3) in reusing an existing database.
Upgrade from an older Corda (open source) release to Corda Enterpise
CorDapps, contracts and states written for Corda 4.x are compatible with Corda Enterprise 4.8, so upgrading
existing open source Corda nodes should be a simple case of updating the Corda
See node-upgrade-notes for general instructions on upgrading your node.
For developer information on recompiling CorDapps against Corda Enterprise, see upgrade-notes.
Reusing an existing database
To reuse an existing database, follow the same database instructions as upgrading within the same Corda version.
Migrating from H2 database to other database vendor
Using a third-party tool to migrate data from a H2 database
R3 have trialled the third-party commercial tool Full Convert for migrating from a H2 database to a 3rd party commercial databases. It can be used via the GUI application or from the command-line, however it only runs on Windows: Vista SP2 and later, as well as Windows Server 2008 and later. The tool works by connecting to both databases simultaneously and migrates tables, their data, and other schema objects form one database to the other. It can be used to migrate from a H2 database by connecting to its database file.