From cb2c532328e787b1f50cc5b6eca8ee0de07a72ed Mon Sep 17 00:00:00 2001 From: black-06 Date: Tue, 11 Apr 2023 11:24:11 +0800 Subject: [PATCH] distinguish between schema.Time and tag time (#133) fix https://github.com/go-gorm/gorm/issues/6033 --- sqlite.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sqlite.go b/sqlite.go index cb1afff..8617f00 100644 --- a/sqlite.go +++ b/sqlite.go @@ -178,7 +178,12 @@ func (dialector Dialector) DataTypeOf(field *schema.Field) string { case schema.String: return "text" case schema.Time: - return "datetime" + // Distinguish between schema.Time and tag time + if val, ok := field.TagSettings["TYPE"]; ok { + return val + } else { + return "datetime" + } case schema.Bytes: return "blob" }