We're updating the issue view to help you get more done. 

Improve upgrade from Corda v3.3 when a node uses PostgreSQL

Description

Corda OS supports H2 database and upgrade from 3.x to Corda 4.0 was tested on H2.
If Corda OS 3.x runs against a PostgreSQL database then due to a Postgres specific lower/uppercase naming policy the automatic upgrade fails as the node doesn't detect that this is the already populated database.
For a workaround, before upgrading Corda OS 3.3 to Corda OS 4.0/4.1 run a manual DDL statements:

CREATE TABLE <schema_name>."NODE_DUMMY" ();

The fix is to add additional check in SchemaMigration class, so this
val existingDatabase = it.metaData.getTables(null, null, "NODE%", null).next()
should be
val existingDatabase = it.metaData.getTables(null, null, "node%", null).next() || it.metaData.getTables(null, null, "NODE%", null).next()

Similar extra check for databasechangelog and DATABASECHANGELOG is needed.

CVSS Vector

None

Status

Assignee

Unassigned

Reporter

Szymon Sztuka

Labels

None

CVSS Score

None

Feature Team

Select team

Target Version/s

None

Ported to...

None

Affects versions

Corda 4.3
Corda 4
Corda 4.1

Priority

Medium