dialect/sql/schema: add mysql spatial type for migration (#1271)

This commit is contained in:
Ariel Mashraki
2021-02-24 22:24:42 +02:00
committed by GitHub
parent 72f8b1281f
commit a0c3976ee5

View File

@@ -266,6 +266,8 @@ func (d *MySQL) cType(c *Column) (t string) {
t = fmt.Sprintf("enum(%s)", strings.Join(values, ", "))
case field.TypeUUID:
t = "char(36) binary"
case field.TypeOther:
t = c.typ
default:
panic(fmt.Sprintf("unsupported type %q for column %q", c.Type.String(), c.Name))
}
@@ -441,6 +443,8 @@ func (d *MySQL) scanColumn(c *Column, rows *sql.Rows) error {
return fmt.Errorf("unknown char(%d) type (not a uuid)", size)
}
c.Type = field.TypeUUID
case "point", "geometry", "linestring", "polygon":
c.Type = field.TypeOther
default:
return fmt.Errorf("unknown column type %q for version %q", parts[0], d.version)
}