feat: set created_at and updated_at to timestamp (#1659)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2022-09-07 19:54:51 +08:00
parent 42e5e2700d
commit 15d35b1464
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
1 changed files with 2 additions and 2 deletions

View File

@ -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:"-"`
}