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.

Status

Assignee

Unassigned

Reporter

Szymon Sztuka

Labels

None

Feature Team

Select team

Story Points

None

Fix versions

None

Ported to...

None

Priority

Medium

Affects versions

Configure