mirror of
https://github.com/ent/ent.git
synced 2026-05-04 08:30:57 +03:00
schema/field: add an option to configure the database type (#484)
This commit is contained in:
@@ -218,7 +218,7 @@ func (d *MySQL) cType(c *Column) (t string) {
|
||||
t = "longtext"
|
||||
}
|
||||
case field.TypeFloat32, field.TypeFloat64:
|
||||
t = "double"
|
||||
t = c.scanTypeOr("double")
|
||||
case field.TypeTime:
|
||||
t = c.scanTypeOr("timestamp")
|
||||
// In MySQL, timestamp columns are `NOT NULL by default, and assigning NULL
|
||||
@@ -354,7 +354,7 @@ func (d *MySQL) scanColumn(c *Column, rows *sql.Rows) error {
|
||||
default:
|
||||
c.Type = field.TypeInt8
|
||||
}
|
||||
case "double":
|
||||
case "numeric", "decimal", "double":
|
||||
c.Type = field.TypeFloat64
|
||||
case "time", "timestamp", "date", "datetime":
|
||||
c.Type = field.TypeTime
|
||||
|
||||
Reference in New Issue
Block a user