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
}
@ -510,17 +513,10 @@ 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}
}
col.SQLType = schemas.SQLType{Name: colType, DefaultLength: len1, DefaultLength2: len2}
if colKey == "PRI" {
col.IsPrimaryKey = true

View File

@ -139,9 +139,10 @@ var (
Money = "MONEY"
SmallMoney = "SMALLMONEY"
Real = "REAL"
Float = "FLOAT"
Double = "DOUBLE"
Real = "REAL"
Float = "FLOAT"
UnsignedFloat = "UNSIGNED FLOAT"
Double = "DOUBLE"
Binary = "BINARY"
VarBinary = "VARBINARY"
@ -208,13 +209,14 @@ var (
SmallDateTime: TIME_TYPE,
Year: TIME_TYPE,
Decimal: NUMERIC_TYPE,
Numeric: NUMERIC_TYPE,
Real: NUMERIC_TYPE,
Float: NUMERIC_TYPE,
Double: NUMERIC_TYPE,
Money: NUMERIC_TYPE,
SmallMoney: NUMERIC_TYPE,
Decimal: NUMERIC_TYPE,
Numeric: NUMERIC_TYPE,
Real: NUMERIC_TYPE,
Float: NUMERIC_TYPE,
UnsignedFloat: NUMERIC_TYPE,
Double: NUMERIC_TYPE,
Money: NUMERIC_TYPE,
SmallMoney: NUMERIC_TYPE,
Binary: BLOB_TYPE,
VarBinary: BLOB_TYPE,