diff --git a/entc/gen/type.go b/entc/gen/type.go index 2601f21f2..05d476c98 100644 --- a/entc/gen/type.go +++ b/entc/gen/type.go @@ -919,7 +919,7 @@ func (f Field) size() int64 { func (f Field) PK() *schema.Column { c := &schema.Column{ Name: f.StorageKey(), - Type: field.TypeInt, + Type: f.Type.Type, Key: schema.PrimaryKey, Increment: true, } diff --git a/entc/integration/idtype/ent/migrate/schema.go b/entc/integration/idtype/ent/migrate/schema.go index 7c08c7257..4486b41b6 100644 --- a/entc/integration/idtype/ent/migrate/schema.go +++ b/entc/integration/idtype/ent/migrate/schema.go @@ -14,9 +14,9 @@ import ( var ( // UsersColumns holds the columns for the "users" table. UsersColumns = []*schema.Column{ - {Name: "id", Type: field.TypeInt, Increment: true}, + {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, - {Name: "user_spouse", Type: field.TypeInt, Unique: true, Nullable: true}, + {Name: "user_spouse", Type: field.TypeUint64, Unique: true, Nullable: true}, } // UsersTable holds the schema information for the "users" table. UsersTable = &schema.Table{