diff --git a/dialect/entsql/annotation.go b/dialect/entsql/annotation.go index ee8f2c130..85751b038 100644 --- a/dialect/entsql/annotation.go +++ b/dialect/entsql/annotation.go @@ -86,6 +86,14 @@ type Annotation struct { // } // OnDelete ReferenceOption `json:"on_delete,omitempty"` + + // Check allows injecting custom "DDL" for setting the "CHECK" clause in "CREATE TABLE". + // + // entsql.Annotation{ + // Check: "age < 10", + // } + // + Check string `json:"check,omitempty"` } // Name describes the annotation name. @@ -127,6 +135,9 @@ func (a Annotation) Merge(other schema.Annotation) schema.Annotation { if s := ant.OnDelete; s != "" { a.OnDelete = s } + if s := ant.Check; s != "" { + a.Check = s + } return a }