Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: EXPOSED-135 Oracle does not use setSchema value as currentScheme #1828

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class JdbcDatabaseMetadataImpl(database: String, val metadata: DatabaseMetaData)
field = try {
when (databaseDialectName) {
MysqlDialect.dialectName, MariaDBDialect.dialectName -> metadata.connection.catalog.orEmpty()
OracleDialect.dialectName -> databaseName
OracleDialect.dialectName -> metadata.connection.schema ?: databaseName
else -> metadata.connection.schema.orEmpty()
}
} catch (_: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class CreateIndexTests : DatabaseTestsBase() {
}

@Test
fun `test possibility to create indexes when table exists in different schemas`() {
val TestTable = object : Table("test_table") {
fun testCreateIndexWithTableInDifferentSchemas() {
val testTable = object : Table("test_table") {
val id = integer("id").uniqueIndex()
val name = varchar("name", length = 42).index("test_index")
init {
Expand All @@ -81,16 +81,15 @@ class CreateIndexTests : DatabaseTestsBase() {
val schema2 = Schema("Schema2")
withSchemas(listOf(TestDB.SQLITE, TestDB.SQLSERVER), schema1, schema2) {
SchemaUtils.setSchema(schema1)
SchemaUtils.createMissingTablesAndColumns(TestTable)
assertEquals(true, TestTable.exists())
SchemaUtils.createMissingTablesAndColumns(testTable)
assertEquals(true, testTable.exists())
SchemaUtils.setSchema(schema2)
assertEquals(false, TestTable.exists())
SchemaUtils.createMissingTablesAndColumns(TestTable)
assertEquals(true, TestTable.exists())
assertEquals(false, testTable.exists())
SchemaUtils.createMissingTablesAndColumns(testTable)
assertEquals(true, testTable.exists())
}
}


@Test
fun testCreateAndDropPartialIndexWithPostgres() {
val partialIndexTable = object : IntIdTable("PartialIndexTableTest") {
Expand Down
Loading