From a4fdb0dee813cb78d8e2d98e6365832d8d27c203 Mon Sep 17 00:00:00 2001 From: r1v3r Date: Tue, 18 Jan 2022 21:16:21 +0800 Subject: [PATCH] fix(generate): created/updated_at without default (#359) * fix(generate): created/updated/deleted_at without default * feat(generate): remove verbose judge --- internal/model/tbl_column.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/model/tbl_column.go b/internal/model/tbl_column.go index a7cd7251..65bc532a 100644 --- a/internal/model/tbl_column.go +++ b/internal/model/tbl_column.go @@ -94,7 +94,8 @@ func (c *Column) buildGormTag() string { buf.WriteString(fmt.Sprintf(";index:%s,priority:%d", idx.IndexName, idx.SeqInIndex)) } } - if c.ColumnDefault != "" { + if c.ColumnDefault != "" && + c.ColumnName != "created_at" && c.ColumnName != "updated_at" { buf.WriteString(fmt.Sprintf(";default:%s", c.ColumnDefault)) } return buf.String()