From b99f2d827067caef22fdd72c967f597515fba15d Mon Sep 17 00:00:00 2001 From: "lotus.wu" Date: Thu, 17 Oct 2019 23:36:06 +0800 Subject: [PATCH] 1. suport date time '2070-03-30 00:00:00',timestamp can't support large date time. (#1823) --- dialect_mysql.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dialect_mysql.go b/dialect_mysql.go index ac9b3b2e..da46d586 100644 --- a/dialect_mysql.go +++ b/dialect_mysql.go @@ -103,10 +103,10 @@ func (s *mysql) DataTypeOf(field *StructField) string { precision = fmt.Sprintf("(%s)", p) } - if _, ok := field.TagSettingsGet("NOT NULL"); ok || field.IsPrimaryKey { - sqlType = fmt.Sprintf("timestamp%v", precision) + if _, ok := field.TagSettings["NOT NULL"]; ok || field.IsPrimaryKey { + sqlType = fmt.Sprintf("DATETIME%v", precision) } else { - sqlType = fmt.Sprintf("timestamp%v NULL", precision) + sqlType = fmt.Sprintf("DATETIME%v NULL", precision) } } default: