feat(manager): add default value for operated_at (#3966)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2025-04-17 19:13:57 +08:00 committed by GitHub
parent fb84accb14
commit 993585729f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -60,7 +60,7 @@ type Audit struct {
// Operation represents the operation, it will be the HTTP method for API events.
Operation string `gorm:"column:operation;type:varchar(256);not null;comment:operation" json:"operation"`
// OperatedAt represents the operation time.
OperatedAt time.Time `gorm:"column:operated_at;type:timestamp;not null;comment:operation time" json:"operated_at"`
OperatedAt time.Time `gorm:"column:operated_at;type:timestamp;default:current_timestamp;comment:operated at" json:"operated_at"`
// State represents the state, it indicates the state of the operation, e.g SUCCESS for API status code >= 200 & < 300.
State string `gorm:"column:state;type:varchar(100);not null;comment:state" json:"state"`
// Path represents the request path, it will be the URL path for API events.

View File

@ -30,8 +30,8 @@ import (
type BaseModel struct {
ID uint `gorm:"primarykey;comment:id" json:"id"`
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"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:current_timestamp;comment:created at" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:current_timestamp;comment:updated at" json:"updated_at"`
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag;comment:soft delete flag" json:"is_del"`
}