-
Notifications
You must be signed in to change notification settings - Fork 753
Open
Description
It would be great to be able to do something like this with an API
CREATE INDEX IF NOT EXISTS unit_operations_time_idx ON unit_operations (time DESC);
for now, I need to use some code like this to implement this:
object UnitOperationsTable : LongIdTable("unit_operations") {
val unitId = integer("unit_id")
val time = defaultNowTimestampTz("time")
init {
index(customIndexName = "unit_operations_unit_id_idx", columns = arrayOf(unitId))
try {
transaction {
exec("CREATE INDEX IF NOT EXISTS unit_operations_time_idx ON unit_operations (time DESC);")
}
} catch (_: ExposedSQLException) {
// when run first time, the table may not exist, so ignore the error
}
}
}
and you see, index wil not created at the first time.
I'd like some other alternative way to do this
Metadata
Metadata
Assignees
Labels
No labels