feat(manager): add default value for operated_at (#3966)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
fb84accb14
commit
993585729f
|
|
@ -60,7 +60,7 @@ type Audit struct {
|
||||||
// Operation represents the operation, it will be the HTTP method for API events.
|
// 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"`
|
Operation string `gorm:"column:operation;type:varchar(256);not null;comment:operation" json:"operation"`
|
||||||
// OperatedAt represents the operation time.
|
// 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 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"`
|
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.
|
// Path represents the request path, it will be the URL path for API events.
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ import (
|
||||||
|
|
||||||
type BaseModel struct {
|
type BaseModel struct {
|
||||||
ID uint `gorm:"primarykey;comment:id" json:"id"`
|
ID uint `gorm:"primarykey;comment:id" json:"id"`
|
||||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:current_timestamp" json:"created_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" json:"updated_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"`
|
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag;comment:soft delete flag" json:"is_del"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue