mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
entc/gen: add support for default annotation to PKs as well (#1492)
This commit is contained in:
@@ -1198,6 +1198,11 @@ func (f Field) PK() *schema.Column {
|
||||
c.Size = *f.def.Size
|
||||
}
|
||||
}
|
||||
// Override the default-value defined in the
|
||||
// schema if it was provided by an annotation.
|
||||
if ant := f.EntSQL(); ant != nil && ant.Default != "" {
|
||||
c.Default = strconv.Quote(ant.Default)
|
||||
}
|
||||
if f.def != nil {
|
||||
c.SchemaType = f.def.SchemaType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user