forked from mirror/gorm
1. suport date time '2070-03-30 00:00:00',timestamp can't support large date time. (#1823)
This commit is contained in:
parent
120d39b4d6
commit
b99f2d8270
|
@ -103,10 +103,10 @@ func (s *mysql) DataTypeOf(field *StructField) string {
|
||||||
precision = fmt.Sprintf("(%s)", p)
|
precision = fmt.Sprintf("(%s)", p)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := field.TagSettingsGet("NOT NULL"); ok || field.IsPrimaryKey {
|
if _, ok := field.TagSettings["NOT NULL"]; ok || field.IsPrimaryKey {
|
||||||
sqlType = fmt.Sprintf("timestamp%v", precision)
|
sqlType = fmt.Sprintf("DATETIME%v", precision)
|
||||||
} else {
|
} else {
|
||||||
sqlType = fmt.Sprintf("timestamp%v NULL", precision)
|
sqlType = fmt.Sprintf("DATETIME%v NULL", precision)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue