I see there’s a check function on a field (Column&...
# exposed
g
I see there’s a check function on a field (Column<T>), is there an example using this somewhere?
s
The
check
function is used to define check constraints, you can see a couple of examples here: https://github.com/JetBrains/Exposed/blob/master/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/DDLTests.kt#L588-L650
g
Can I do a request in there to see if the value.lowerCase() I am trying to insert is not already present in the table on sameField.toLowerCase() ?
s
I'm no expert in SQL but I think you cannot have sub queries inside a check constraint. One solution would be to check it manually or to use triggers, but for that you'll have to create them manually.
g
I see, thanks