Files
ent/doc/md/schema-config.md
Ariel Mashraki fd0a7f9f02 all: facebookincubator/ent => facebook/ent (#660)
ent repository is going to be migrated to facebook organization
2020-08-18 11:05:08 +03:00

35 lines
471 B
Markdown
Executable File

---
id: schema-config
title: Config
---
## Custom Table Name
A custom table name can be provided for types using the `Table` option as follows:
```go
package schema
import (
"github.com/facebook/ent"
"github.com/facebook/ent/schema/field"
)
type User struct {
ent.Schema
}
func (User) Config() ent.Config {
return ent.Config{
Table: "Users",
}
}
func (User) Fields() []ent.Field {
return []ent.Field{
field.Int("age"),
field.String("name"),
}
}
```