ent/schema: allow setting collation for string fields

Reviewed By: a8m

Differential Revision: D17090481

fbshipit-source-id: a08768c9bac4318a91bc6a067c85d6eb022c3024
This commit is contained in:
Alex Snast
2019-08-28 04:51:27 -07:00
committed by Facebook Github Bot
parent 419753b33b
commit 4c1f28d58f
57 changed files with 955 additions and 155 deletions

View File

@@ -30,6 +30,7 @@ type Field struct {
Tag string `json:"tag,omitempty"`
Size *int `json:"size,omitempty"`
Charset *string `json:"charset,omitempty"`
Collation *string `json:"collation,omitempty"`
Unique bool `json:"unique,omitempty"`
Nillable bool `json:"nillable,omitempty"`
Optional bool `json:"optional,omitempty"`
@@ -103,6 +104,9 @@ func MarshalSchema(schema ent.Interface) (b []byte, err error) {
if fd.Charset != "" {
sf.Charset = &fd.Charset
}
if fd.Collation != "" {
sf.Collation = &fd.Collation
}
s.Fields = append(s.Fields, sf)
}
edges, err := safeEdges(schema)