dialect/sql/schema: accept convert from string2enum and enum2stirng (#587)

This commit is contained in:
Ariel Mashraki
2020-07-05 22:22:50 +03:00
committed by GitHub
parent 1a8d98f507
commit cedeef653a
17 changed files with 598 additions and 5 deletions

View File

@@ -171,6 +171,9 @@ func (c *Column) ConvertibleTo(d *Column) bool {
case c.UintType() && d.IntType():
// uintX can not be converted to intY, when X > Y.
return c.Type-field.TypeUint8 <= d.Type-field.TypeInt8
case c.Type == field.TypeString && d.Type == field.TypeEnum ||
c.Type == field.TypeEnum && d.Type == field.TypeString:
return true
}
return c.FloatType() && d.FloatType()
}