schema/field: add an option to configure the database type (#484)

This commit is contained in:
Ariel Mashraki
2020-05-11 15:07:33 +03:00
committed by GitHub
parent 68db86be76
commit cfee55e514
25 changed files with 1126 additions and 26 deletions

View File

@@ -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