dialect/sql/schema: postgres support for uuid type

Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/178

Reviewed By: alexsn

Differential Revision: D18615561

fbshipit-source-id: 8244189186bf35d78cfdb991ee4f8cecd6411cee
This commit is contained in:
Ariel Mashraki
2019-11-20 09:47:48 -08:00
committed by Facebook Github Bot
parent 33d08673cf
commit db7b05ad04
2 changed files with 8 additions and 1 deletions

View File

@@ -220,6 +220,8 @@ func (d *Postgres) scanColumn(c *Column, rows *sql.Rows) error {
c.Type = field.TypeBytes
case "jsonb":
c.Type = field.TypeJSON
case "uuid":
c.Type = field.TypeUUID
}
switch {
case !defaults.Valid:
@@ -265,6 +267,8 @@ func (d *Postgres) cType(c *Column) (t string) {
t = "bytea"
case field.TypeJSON:
t = "jsonb"
case field.TypeUUID:
t = "uuid"
case field.TypeString:
t = "varchar"
if c.Size > maxCharSize {