mirror of
https://github.com/ent/ent.git
synced 2026-05-04 00:20:58 +03:00
dialect/sql/schema: alter table for postgres
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/115 Reviewed By: alexsn Differential Revision: D18065988 fbshipit-source-id: a7d33bbebd63b01659bc5ba562ac85642dcd3d83
This commit is contained in:
committed by
Facebook Github Bot
parent
dff3067639
commit
2789257849
@@ -397,7 +397,7 @@ func (c *Column) ScanMySQL(rows *sql.Rows) error {
|
||||
c.Enums[i] = strings.Trim(e, "'")
|
||||
}
|
||||
}
|
||||
if defaults.Valid && defaults.String != Null {
|
||||
if defaults.Valid {
|
||||
return c.ScanDefault(defaults.String)
|
||||
}
|
||||
return nil
|
||||
@@ -429,6 +429,7 @@ func (c Column) FloatType() bool { return c.Type == field.TypeFloat32 || c.Type
|
||||
// ScanDefault scans the default value string to its interface type.
|
||||
func (c *Column) ScanDefault(value string) (err error) {
|
||||
switch {
|
||||
case value == Null: // ignore.
|
||||
case c.IntType():
|
||||
v := &sql.NullInt64{}
|
||||
if err := v.Scan(value); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user