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

View File

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

View File

@ -512,7 +512,7 @@ func TestUnsignedTinyInt(t *testing.T) {
case schemas.MYSQL:
assert.EqualValues(t, "UNSIGNED TINYINT", tables[0].Columns()[0].SQLType.Name)
case schemas.POSTGRES:
assert.EqualValues(t, "INT", tables[0].Columns()[0].SQLType.Name)
assert.EqualValues(t, "SMALLINT", tables[0].Columns()[0].SQLType.Name)
case schemas.MSSQL:
assert.EqualValues(t, "INT", tables[0].Columns()[0].SQLType.Name)
default: