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
It would be great to be able to do something like this with an API
for now, I need to use some code like this to implement this:
and you see, index wil not created at the first time.
I'd like some other alternative way to do this