Fix mssql

This commit is contained in:
Lunny Xiao 2021-07-29 09:21:50 +08:00
parent 5510be60a3
commit c14c385394
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 3 additions and 3 deletions

View File

@ -318,7 +318,7 @@ func (db *mssql) SQLType(c *schemas.Column) string {
case schemas.TimeStampz: case schemas.TimeStampz:
res = "DATETIMEOFFSET" res = "DATETIMEOFFSET"
c.Length = 7 c.Length = 7
case schemas.MediumInt: case schemas.MediumInt, schemas.TinyInt, schemas.SmallInt, schemas.UnsignedMediumInt, schemas.UnsignedTinyInt, schemas.UnsignedSmallInt:
res = schemas.Int res = schemas.Int
case schemas.Text, schemas.MediumText, schemas.TinyText, schemas.LongText, schemas.Json: case schemas.Text, schemas.MediumText, schemas.TinyText, schemas.LongText, schemas.Json:
res = db.defaultVarchar + "(MAX)" res = db.defaultVarchar + "(MAX)"

View File

@ -879,13 +879,13 @@ func (db *postgres) SetQuotePolicy(quotePolicy QuotePolicy) {
func (db *postgres) SQLType(c *schemas.Column) string { func (db *postgres) SQLType(c *schemas.Column) string {
var res string var res string
switch t := c.SQLType.Name; t { switch t := c.SQLType.Name; t {
case schemas.TinyInt, schemas.UnsignedTinyInt, schemas.UnsignedSmallInt: case schemas.TinyInt, schemas.UnsignedTinyInt:
res = schemas.SmallInt res = schemas.SmallInt
return res return res
case schemas.Bit: case schemas.Bit:
res = schemas.Boolean res = schemas.Boolean
return res return res
case schemas.MediumInt, schemas.Int, schemas.Integer, schemas.UnsignedMediumInt: case schemas.MediumInt, schemas.Int, schemas.Integer, schemas.UnsignedMediumInt, schemas.UnsignedSmallInt:
if c.IsAutoIncrement { if c.IsAutoIncrement {
return schemas.Serial return schemas.Serial
} }