slick/slick — pull request #849 by imcharsi (2014-06-11 17:34:40+00:00)
Title: DDL for check constraint.

DDL for check constraint.

Hi.

This is to create DDL for Check Constraint.
This feature creates ALTER TABLE DDL instead of CREATE TABLE DDL.
Use this feature like below.
```
class Categories(tag: Tag) extends Table[(Int, String)](tag, "cat_checkconstraint") {
def id = column[Int]("id")

def name = column[String]("name")

def checkConstraintOne = checkConstraint("chk_1", (t: Categories) => (t.id < 10))

def checkConstraintTwo = checkConstraint("chk_2", (t: Categories) => (t.name.like("%10%")))

def checkConstraintThree = checkConstraint("chk_3", (t: Categories) => (t.id < 20 && t.name.like("%100%")))

def * = (id, name)
}
```
Note that you should use like this
```
(t: Categories) => (t.id < 10)
```
You should specify valid type explicitly. I can't find a workaround for this.

For now(20140612), In MySQL5.5, The supporting for check constraint is just fake.
And, In SQLite3.7, I can't find valid syntax for "alter table".
If you know "working" syntax, please tell me.
So, In these cases, this feature doesn't work and doesn't create any DDL about check constraint.
And, related test doesn't work for these case. It just ignores these DBMS.

This feature was copied from Query.filter almost,
And, uses JdbcStatementBuilderComponent.buildWhereClause heavily.

Thanks.