forked from mirror/gorm
corresponds timestamp precision for mysql
This commit is contained in:
parent
89a726ce5d
commit
ae696d051f
|
@ -96,9 +96,9 @@ func (s *mysql) DataTypeOf(field *StructField) string {
|
||||||
case reflect.Struct:
|
case reflect.Struct:
|
||||||
if _, ok := dataValue.Interface().(time.Time); ok {
|
if _, ok := dataValue.Interface().(time.Time); ok {
|
||||||
if _, ok := field.TagSettings["NOT NULL"]; ok {
|
if _, ok := field.TagSettings["NOT NULL"]; ok {
|
||||||
sqlType = "timestamp"
|
sqlType = fmt.Sprintf("timestamp(%d)", size)
|
||||||
} else {
|
} else {
|
||||||
sqlType = "timestamp NULL"
|
sqlType = fmt.Sprintf("timestamp(%d) NULL", size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue