From 15d35b14648e30c7c3afd833ba613ca1e28bc6d4 Mon Sep 17 00:00:00 2001 From: Gaius Date: Wed, 7 Sep 2022 19:54:51 +0800 Subject: [PATCH] feat: set created_at and updated_at to timestamp (#1659) Signed-off-by: Gaius --- manager/model/models.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manager/model/models.go b/manager/model/models.go index 2a00b17ca..a00926f1e 100644 --- a/manager/model/models.go +++ b/manager/model/models.go @@ -30,8 +30,8 @@ import ( type Model struct { ID uint `gorm:"primarykey;comment:id" json:"id"` - CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` - UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` + CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:current_timestamp" json:"created_at"` + UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:current_timestamp" json:"updated_at"` IsDel soft_delete.DeletedAt `gorm:"softDelete:flag;comment:soft delete flag" json:"-"` }