fix bit type on postgres

This commit is contained in:
Lunny Xiao 2017-09-09 16:52:57 +08:00
parent 6a56f45255
commit d4a068ff06
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 4 additions and 1 deletions

View File

@ -781,6 +781,9 @@ func (db *postgres) SqlType(c *core.Column) string {
case core.TinyInt: case core.TinyInt:
res = core.SmallInt res = core.SmallInt
return res return res
case core.Bit:
res = core.Boolean
return res
case core.MediumInt, core.Int, core.Integer: case core.MediumInt, core.Int, core.Integer:
if c.IsAutoIncrement { if c.IsAutoIncrement {
return core.Serial return core.Serial

View File

@ -65,7 +65,7 @@ func TestQueryString2(t *testing.T) {
assert.Equal(t, 1, len(records)) assert.Equal(t, 1, len(records))
assert.Equal(t, 2, len(records[0])) assert.Equal(t, 2, len(records[0]))
assert.Equal(t, "1", records[0]["id"]) assert.Equal(t, "1", records[0]["id"])
assert.Equal(t, "0", records[0]["msg"]) assert.True(t, "0" == records[0]["msg"] || "false" == records[0]["msg"])
} }
func toString(i interface{}) string { func toString(i interface{}) string {