entc/gen: derive the id-type from the schema (#823)

if it was not provided
This commit is contained in:
Ariel Mashraki
2020-10-06 16:29:09 +03:00
committed by GitHub
parent 3f3debbe97
commit 48362e79cd
3 changed files with 31 additions and 5 deletions

View File

@@ -17,7 +17,6 @@ import (
"github.com/facebook/ent/entc/gen"
"github.com/facebook/ent/entc/load"
"github.com/facebook/ent/schema/field"
)
// LoadGraph loads the schema package from the given schema path,
@@ -58,9 +57,6 @@ func Generate(schemaPath string, cfg *gen.Config, options ...Option) (err error)
// the schema.
cfg.Target = filepath.Dir(abs)
}
if cfg.IDType == nil {
cfg.IDType = &field.TypeInfo{Type: field.TypeInt}
}
for _, opt := range options {
if err := opt(cfg); err != nil {
return err