mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
dialect/sql/schema: handle sql json type for schema OfflineMigration (#542)
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
This commit is contained in:
committed by
GitHub
parent
9a47fea02c
commit
e03e387988
@@ -218,6 +218,12 @@ func (c *Column) ScanDefault(value string) error {
|
||||
return fmt.Errorf("scanning string value for column %q: %v", c.Name, err)
|
||||
}
|
||||
c.Default = v.String
|
||||
case c.Type == field.TypeJSON:
|
||||
v := &sql.NullString{}
|
||||
if err := v.Scan(value); err != nil {
|
||||
return fmt.Errorf("scanning json value for column %q: %v", c.Name, err)
|
||||
}
|
||||
c.Default = v.String
|
||||
default:
|
||||
return fmt.Errorf("unsupported type: %v", c.Type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user