You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any plan to support check constraints in the future?
Suggestion
Method signature
/** * Creates a check constraint in this column * @param name The name of the constraint, optional * @param op The expression that the value of this column must satisfy*/fun <T> Column<T>.check(name:String = "", op:SqlExpressionBuilder.(Column<T>) ->Op<Boolean>): Column<T> { ... }
Usage
object CheckTable : Table("myTable") {
val id = integer("id").autoIncrement().primaryKey()
val positive = integer("positive").check { it greaterEq 0 }
val oneToTen = integer("oneToTen").check("myCheck") { it.between(1, 10) }
val greaterThanId = integer("greaterThanId").check { it.greater(id) }
}
SQLite Output
CREATETABLEIF NOT EXISTS myTable (
id INTEGERPRIMARY KEY,
positive INTNOT NULLCHECK (positive >=0),
oneToTen INTNOT NULLCONSTRAINT myCheck CHECK (oneToTen BETWEEN 1AND10),
greaterThanId INTNOT NULLCHECK (greaterThanId > id)
);
The text was updated successfully, but these errors were encountered:
SackCastellon
changed the title
Support for "check constraints"?
Support for check constraints?
Mar 16, 2018
* #268 Add support for check constraints.
* Add support for multi-column check constraints
* Fixed error when parsing check constraints
* Improved CHECK constraint support
- Warning shown when trying to create a CHECK constraint in MySQL
- Constraint with names that were already added are ignored and a warning is shown
- White spaces are now trimmed from constraint names
- Improved tests
* Replaced exception with warn log when using on an unsupported database
Is there any plan to support check constraints in the future?
Suggestion
Method signature
Usage
SQLite Output
The text was updated successfully, but these errors were encountered: