This commit is contained in:
Lunny Xiao 2020-07-09 00:32:27 +08:00
parent 00ede8b543
commit 61de120657
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 5 additions and 3 deletions

View File

@ -231,6 +231,7 @@ func (db *mssql) SQLType(c *schemas.Column) string {
} else if strings.EqualFold(c.Default, "false") { } else if strings.EqualFold(c.Default, "false") {
c.Default = "0" c.Default = "0"
} }
return res
case schemas.Serial: case schemas.Serial:
c.IsAutoIncrement = true c.IsAutoIncrement = true
c.IsPrimaryKey = true c.IsPrimaryKey = true
@ -270,8 +271,8 @@ func (db *mssql) SQLType(c *schemas.Column) string {
res = t res = t
} }
if res == schemas.Int { if res == schemas.Int || res == schemas.Bit || res == schemas.DateTime {
return schemas.Int return res
} }
hasLen1 := (c.Length > 0) hasLen1 := (c.Length > 0)

View File

@ -417,7 +417,8 @@ func formatColumnValue(dstDialect dialects.Dialect, d interface{}, col *schemas.
return "NULL" return "NULL"
} }
if dq, ok := d.(bool); ok && dstDialect.URI().DBType == schemas.SQLITE { if dq, ok := d.(bool); ok && (dstDialect.URI().DBType == schemas.SQLITE ||
dstDialect.URI().DBType == schemas.MSSQL) {
if dq { if dq {
return "1" return "1"
} }