mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
example/migration: improve atlas migration example (#3092)
This commit is contained in:
@@ -136,6 +136,30 @@ func (Annotation) Name() string {
|
||||
return "EntSQL"
|
||||
}
|
||||
|
||||
// Check allows injecting custom "DDL" for setting an unnamed "CHECK" clause in "CREATE TABLE".
|
||||
//
|
||||
// entsql.Annotation{
|
||||
// Check: "(`age` < 10)",
|
||||
// }
|
||||
func Check(c string) *Annotation {
|
||||
return &Annotation{
|
||||
Check: c,
|
||||
}
|
||||
}
|
||||
|
||||
// Checks allows injecting custom "DDL" for setting named "CHECK" clauses in "CREATE TABLE".
|
||||
//
|
||||
// entsql.Annotation{
|
||||
// Checks: map[string]string{
|
||||
// "valid_discount": "price > discount_price",
|
||||
// },
|
||||
// }
|
||||
func Checks(c map[string]string) *Annotation {
|
||||
return &Annotation{
|
||||
Checks: c,
|
||||
}
|
||||
}
|
||||
|
||||
// Default specifies a literal default value of a column. Note that using
|
||||
// this option overrides the default behavior of the code-generation.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user