From 5800f6b578ab43da9f5d42ff8f33137aec9eeb7f Mon Sep 17 00:00:00 2001 From: Ariel Mashraki <7413593+a8m@users.noreply.github.com> Date: Fri, 27 May 2022 23:54:41 +0300 Subject: [PATCH] entc/gen: avoid setting the incremental attribute fo non-integer fields (#2571) --- entc/gen/type.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entc/gen/type.go b/entc/gen/type.go index 64b5b840e..a0733f721 100644 --- a/entc/gen/type.go +++ b/entc/gen/type.go @@ -1312,9 +1312,9 @@ func (f Field) PK() *schema.Column { Name: f.StorageKey(), Type: f.Type.Type, Key: schema.PrimaryKey, - Increment: f.incremental(true), + Increment: f.incremental(f.Type.Type.Integer()), } - // If the PK was defined by the user and it's UUID or string. + // If the PK was defined by the user, and it is UUID or string. if f.UserDefined && !f.Type.Numeric() { c.Increment = false c.Type = f.Type.Type