From ac633bef2f256b1b5777e0d9de21264ec17d217e Mon Sep 17 00:00:00 2001 From: szymonsztuka Date: Tue, 29 Oct 2019 11:22:52 +0000 Subject: [PATCH] CORDA-3348 Migration from Corda 3.x to 4.x for PostgreSQL require a manual workaround - fix by probing for lowercase table as well to detect if this is an existing database (#5625) --- .../net/corda/nodeapi/internal/persistence/SchemaMigration.kt | 4 ++++ 1 file changed, 4 insertions(+) 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 84f028aea8..b93d5de731 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 @@ -172,8 +172,12 @@ class SchemaMigration( val (isExistingDBWithoutLiquibase, isFinanceAppWithLiquibaseNotMigrated) = dataSource.connection.use { val existingDatabase = it.metaData.getTables(null, null, "NODE%", null).next() + // Lower case names for PostgreSQL + || it.metaData.getTables(null, null, "node%", null).next() val hasLiquibase = it.metaData.getTables(null, null, "DATABASECHANGELOG%", null).next() + // Lower case names for PostgreSQL + || it.metaData.getTables(null, null, "databasechangelog%", null).next() val isFinanceAppWithLiquibaseNotMigrated = isFinanceAppWithLiquibase // If Finance App is pre v4.0 then no need to migrate it so no need to check. && existingDatabase