This commit is contained in:
Lunny Xiao 2023-08-07 13:14:39 +08:00
parent b246bd26c5
commit becdd74179
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 16 additions and 18 deletions

View File

@ -319,6 +319,9 @@ func (db *mysql) SQLType(c *schemas.Column) string {
case schemas.UnsignedTinyInt:
res = schemas.TinyInt
isUnsigned = true
case schemas.UnsignedFloat:
res = schemas.Float
isUnsigned = true
default:
res = t
}
@ -511,16 +514,9 @@ func (db *mysql) GetColumns(queryer core.Queryer, ctx context.Context, tableName
col.Length = len1
col.Length2 = len2
if _, ok := schemas.SqlTypes[colType]; !ok {
if !strings.HasPrefix(colType, "UNSIGNED ") {
return nil, nil, fmt.Errorf("unknown colType %v", colType)
}
colType = colType[len("UNSIGNED "):]
}
if _, ok := schemas.SqlTypes[colType]; !ok {
return nil, nil, fmt.Errorf("unknown colType %v", colType)
} else {
col.SQLType = schemas.SQLType{Name: colType, DefaultLength: len1, DefaultLength2: len2}
}
if colKey == "PRI" {
col.IsPrimaryKey = true

View File

@ -141,6 +141,7 @@ var (
Real = "REAL"
Float = "FLOAT"
UnsignedFloat = "UNSIGNED FLOAT"
Double = "DOUBLE"
Binary = "BINARY"
@ -212,6 +213,7 @@ var (
Numeric: NUMERIC_TYPE,
Real: NUMERIC_TYPE,
Float: NUMERIC_TYPE,
UnsignedFloat: NUMERIC_TYPE,
Double: NUMERIC_TYPE,
Money: NUMERIC_TYPE,
SmallMoney: NUMERIC_TYPE,