https://kotlinlang.org logo
#exposed
Title
# exposed
g

galex

03/08/2019, 8:01 AM
I see there’s a check function on a field (Column<T>), is there an example using this somewhere?
s

SackCastellon

03/08/2019, 8:18 AM
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

galex

03/08/2019, 10:30 AM
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

SackCastellon

03/08/2019, 10:39 AM
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

galex

03/11/2019, 4:38 AM
I see, thanks