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