example/migration: improve atlas migration example (#3092)

This commit is contained in:
Ariel Mashraki
2022-11-14 13:58:35 +02:00
committed by GitHub
parent 891fc8fecf
commit 8a8c72f377
18 changed files with 559 additions and 29 deletions

View File

@@ -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.
//