mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
ent/gen: set currect storage-key for indexes
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/66 Reviewed By: alexsn Differential Revision: D17779042 fbshipit-source-id: 12be885b20f91eb611a41e361650f7a66747fab0
This commit is contained in:
committed by
Facebook Github Bot
parent
b64330e475
commit
766940563f
@@ -68,7 +68,7 @@ func (f *File) FromResponse(res *gremlin.Response) error {
|
||||
}
|
||||
var vf struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Size int `json:"size,omitempty"`
|
||||
Size int `json:"fsize,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
User *string `json:"user,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
@@ -156,7 +156,7 @@ func (f *Files) FromResponse(res *gremlin.Response) error {
|
||||
}
|
||||
var vf []struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Size int `json:"size,omitempty"`
|
||||
Size int `json:"fsize,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
User *string `json:"user,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
|
||||
@@ -16,7 +16,7 @@ const (
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldSize holds the string denoting the size vertex property in the database.
|
||||
FieldSize = "size"
|
||||
FieldSize = "fsize"
|
||||
// FieldName holds the string denoting the name vertex property in the database.
|
||||
FieldName = "name"
|
||||
// FieldUser holds the string denoting the user vertex property in the database.
|
||||
|
||||
@@ -85,7 +85,7 @@ var (
|
||||
// FilesColumns holds the columns for the "files" table.
|
||||
FilesColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "size", Type: field.TypeInt, Default: file.DefaultSize},
|
||||
{Name: "fsize", Type: field.TypeInt, Default: file.DefaultSize},
|
||||
{Name: "name", Type: field.TypeString},
|
||||
{Name: "user", Type: field.TypeString, Nullable: true},
|
||||
{Name: "group", Type: field.TypeString, Nullable: true},
|
||||
@@ -123,7 +123,7 @@ var (
|
||||
},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "name_size",
|
||||
Name: "name_fsize",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{FilesColumns[2], FilesColumns[1]},
|
||||
},
|
||||
|
||||
@@ -22,6 +22,7 @@ type File struct {
|
||||
func (File) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("size").
|
||||
StorageKey("fsize").
|
||||
Default(math.MaxInt32).
|
||||
Positive(),
|
||||
field.String("name"),
|
||||
|
||||
Reference in New Issue
Block a user