-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow setting index_type (e.g., 'HASH' or 'BTREE') (#949)
* Allow setting index_type (e.g., 'HASH' or 'BTREE') * review feedback * fix test compilation
- Loading branch information
1 parent
1dce52b
commit 56863e0
Showing
8 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/vendors/MariaDBDialect.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/ddl/CreateIndexTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.jetbrains.exposed.sql.tests.shared.ddl | ||
|
||
import org.jetbrains.exposed.sql.SchemaUtils | ||
import org.jetbrains.exposed.sql.Table | ||
import org.jetbrains.exposed.sql.exists | ||
import org.jetbrains.exposed.sql.tests.DatabaseTestsBase | ||
import org.jetbrains.exposed.sql.tests.TestDB | ||
import org.jetbrains.exposed.sql.tests.shared.assertTrue | ||
import org.junit.Test | ||
|
||
class CreateIndexTests : DatabaseTestsBase() { | ||
|
||
@Test | ||
fun createStandardIndex() { | ||
val TestTable = object : Table("test_table") { | ||
val id = integer("id") | ||
val name = varchar("name", length = 42) | ||
|
||
override val primaryKey = PrimaryKey(id) | ||
val byName = index("test_table_by_name", false, name) | ||
} | ||
|
||
withTables(excludeSettings = listOf(TestDB.H2_MYSQL), tables = *arrayOf(TestTable)) { | ||
SchemaUtils.createMissingTablesAndColumns(TestTable) | ||
assertTrue(TestTable.exists()) | ||
SchemaUtils.drop(TestTable) | ||
} | ||
} | ||
|
||
@Test | ||
fun createHashIndex() { | ||
val TestTable = object : Table("test_table") { | ||
val id = integer("id") | ||
val name = varchar("name", length = 42) | ||
|
||
override val primaryKey = PrimaryKey(id) | ||
val byNameHash = index("test_table_by_name", /* isUnique = */ false, name, indexType = "HASH") | ||
} | ||
|
||
withTables(excludeSettings = listOf(TestDB.H2_MYSQL), tables = *arrayOf(TestTable)) { | ||
SchemaUtils.createMissingTablesAndColumns(TestTable) | ||
assertTrue(TestTable.exists()) | ||
SchemaUtils.drop(TestTable) | ||
} | ||
} | ||
} |