Zachary Sistrunk
06/10/2026, 4:53 PMexec statements for now, but wanted to share them to see if they might be common enough to make a PR for in Exposed.
1. Unable to create virtual columns that are populated using a function (MySQL's VIRTUAL keyword)
2. Unable to set the sort order of indexed columns. This is most applicable when you need mixed sort orders, such as (column_a ASC, column_b DESC). Right now, it defaults to all columns sorted ASC.Chantal Loncle
06/16/2026, 11:56 PMColumn.withDefinition(), which takes any number/combo of plain SQL strings +/- Exposed functions/operators:
object Employees : Table("employees") {
val firstName = varchar("first_name", 128)
val lastName = varchar("last_name", 128)
val fullName = varchar("full_name", 256)
.withDefinition(
"GENERATED ALWAYS AS (",
concat(firstName, stringLiteral(" "), lastName),
") VIRTUAL"
)
.databaseGenerated()
}
I usually recommend chaining .databaseGenerated() to ensure Exposed doesn't complain at any point if you omit this column from other statements.
I can't find a related ticket for the indexed column sort order, but it seems like a promising use case that is missing on the Exposed end. If you feel up for trying to implement a solution, we are certainly open to contributions.Zachary Sistrunk
06/25/2026, 11:40 AM.withDefinition function, thanks! That should work perfect for what I need there.