From 0311205d4d624842b386d74edcd4ea3bf0b8e3b4 Mon Sep 17 00:00:00 2001 From: CyJaySong Date: Sat, 28 Oct 2023 10:13:11 +0800 Subject: [PATCH] Fix the issue of incorrect insertion of data in non UTC time zone zero for numeric types --- dialects/time.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dialects/time.go b/dialects/time.go index a20b5950..4a6beb77 100644 --- a/dialects/time.go +++ b/dialects/time.go @@ -21,6 +21,9 @@ func FormatColumnTime(dialect Dialect, dbLocation *time.Location, col *schemas.C if col.SQLType.IsNumeric() { return 0, nil } + if col.SQLType.Name == schemas.TimeStamp || col.SQLType.Name == schemas.TimeStampz { + t = time.Unix(0, 0) + } } tmZone := dbLocation