mirror of
https://github.com/ent/ent.git
synced 2026-05-04 08:30:57 +03:00
Reviewed By: alexsn Differential Revision: D17599268 fbshipit-source-id: 2d89229e1880a0c33ff26c89d52205981a5cfbab
35 lines
489 B
Markdown
Executable File
35 lines
489 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/facebookincubator/ent"
|
|
"github.com/facebookincubator/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"),
|
|
}
|
|
}
|
|
```
|