Files
ent/entc/integration/migrate/entv1/schema/user.go
Ariel Mashraki 7dfe3c174c sql/schema: more precise blob definition
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/29

Reviewed By: alexsn

Differential Revision: D17284406

fbshipit-source-id: 84c2ffb50b8f016ad361f1420c5352c7969cbc77
2019-09-10 12:40:37 -07:00

36 lines
792 B
Go

// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/field"
"github.com/facebookincubator/ent/schema/index"
)
// User holds the schema definition for the User entity.
type User struct {
ent.Schema
}
// Fields of the User.
func (User) Fields() []ent.Field {
return []ent.Field{
field.Int32("age"),
field.String("name").MaxLen(10),
field.String("address").Optional(),
field.Bytes("blob").
Optional().
MaxLen(255),
}
}
func (User) Indexes() []ent.Index {
return []ent.Index{
index.Fields("name", "address").
Unique(),
}
}