mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-03-07 02:25:37 +08:00
feat: 优化数据库迁移与添加老表迁移
This commit is contained in:
@@ -35,7 +35,7 @@ func GetByIdIn(model any, list any, ids []uint64, orderBy ...string) {
|
||||
// 若 error不为nil,则为不存在该记录
|
||||
// @param model 数据库映射实体模型
|
||||
func GetBy(model any, cols ...string) error {
|
||||
return global.Db.Select(cols).Where(model).Scopes(UndeleteScope).First(model).Error
|
||||
return global.Db.Debug().Select(cols).Where(model).Scopes(UndeleteScope).First(model).Error
|
||||
}
|
||||
|
||||
// 根据model指定条件统计数量
|
||||
|
||||
@@ -15,7 +15,7 @@ const (
|
||||
// 含有删除字段模型
|
||||
type DeletedModel struct {
|
||||
Id uint64 `json:"id"`
|
||||
IsDeleted int8 `json:"-"`
|
||||
IsDeleted int8 `json:"-" gorm:"column:is_deleted;default:0"`
|
||||
DeleteTime *time.Time `json:"-"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user