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)

This commit is contained in:
szymonsztuka 2019-10-29 11:22:52 +00:00 committed by Anthony Keenan
parent 4c7fbbc31b
commit ac633bef2f

View File

@ -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