Fix mssql timestamp

This commit is contained in:
Lunny Xiao 2021-08-03 23:17:49 +08:00
parent 54606d5bfd
commit ef81f61ada
1 changed files with 7 additions and 3 deletions

View File

@ -313,8 +313,12 @@ func (db *mssql) SQLType(c *schemas.Column) string {
if c.Length == 0 {
res += "(MAX)"
}
case schemas.TimeStamp:
res = schemas.DateTime
case schemas.TimeStamp, schemas.DateTime:
if c.Length > 3 {
res = "DATETIME2"
} else {
res = schemas.DateTime
}
case schemas.TimeStampz:
res = "DATETIMEOFFSET"
c.Length = 7
@ -357,7 +361,7 @@ func (db *mssql) SQLType(c *schemas.Column) string {
res = t
}
if res == schemas.Int || res == schemas.Bit || res == schemas.DateTime {
if res == schemas.Int || res == schemas.Bit {
return res
}