mirror of
https://github.com/corda/corda.git
synced 2025-06-17 06:38:21 +00:00
Enable database integration tests against Postgres database (#169)
* For Postgres, if a schema name is provided then it's wrapped in double quotes before passing to Hibernate to preserve case-sensitivity, Liquibase does it out-of-box. * Sql setup scripts for PostgreSQL and datasource configuration.
This commit is contained in:
@ -51,7 +51,13 @@ class HibernateConfiguration(
|
||||
.setProperty("hibernate.connection.isolation", databaseConfig.transactionIsolationLevel.jdbcValue.toString())
|
||||
|
||||
databaseConfig.schema?.apply {
|
||||
config.setProperty("hibernate.default_schema", databaseConfig.schema)
|
||||
//preserving case-sensitive schema name for PostgreSQL by wrapping in double quotes, schema without double quotes would be treated as case-insensitive (lower cases)
|
||||
val schemaName = if (jdbcUrl.contains(":postgresql:", ignoreCase = true) && !databaseConfig.schema.startsWith("\"")) {
|
||||
"\"" + databaseConfig.schema + "\""
|
||||
} else {
|
||||
databaseConfig.schema
|
||||
}
|
||||
config.setProperty("hibernate.default_schema", schemaName)
|
||||
}
|
||||
|
||||
schemas.forEach { schema ->
|
||||
@ -97,7 +103,7 @@ class HibernateConfiguration(
|
||||
applyBasicType(CordaWrapperBinaryType, CordaWrapperBinaryType.name)
|
||||
// When connecting to SqlServer (and only then) do we need to tell hibernate to use
|
||||
// nationalised (i.e. Unicode) strings by default
|
||||
val forceUnicodeForSqlServer = jdbcUrl.contains(":sqlserver:", ignoreCase = true);
|
||||
val forceUnicodeForSqlServer = jdbcUrl.contains(":sqlserver:", ignoreCase = true)
|
||||
enableGlobalNationalizedCharacterDataSupport(forceUnicodeForSqlServer)
|
||||
build()
|
||||
}
|
||||
|
Reference in New Issue
Block a user