From 2e511b5027d04d9905f3cc2fc7e3773ca394565d Mon Sep 17 00:00:00 2001 From: xiusin Date: Fri, 28 Feb 2020 10:18:00 +0000 Subject: [PATCH] fix colType miss --- dialects/mysql.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dialects/mysql.go b/dialects/mysql.go index 62fc6eb1..85720280 100644 --- a/dialects/mysql.go +++ b/dialects/mysql.go @@ -394,7 +394,12 @@ func (db *mysql) GetColumns(ctx context.Context, tableName string) ([]string, ma if colType == "DOUBLE UNSIGNED" { colType = "DOUBLE" } - col.Length = len1 + + if strings.Contains(colType, "INT UNSIGNED") { + colType = strings.TrimRight(colType, " UNSIGNED") + } + + col.Length = len1 col.Length2 = len2 if _, ok := schemas.SqlTypes[colType]; ok { col.SQLType = schemas.SQLType{Name: colType, DefaultLength: len1, DefaultLength2: len2}