Files
ent/doc/md/schema-config.md
Ariel Mashraki 6a0a247c57 ent/doc: add config option to docs
Reviewed By: alexsn

Differential Revision: D17599268

fbshipit-source-id: 2d89229e1880a0c33ff26c89d52205981a5cfbab
2019-09-26 05:59:27 -07:00

489 B
Executable File

id, title
id title
schema-config Config

Custom Table Name

A custom table name can be provided for types using the Table option as follows:

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"),
	}
}