mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-06 22:55:46 +08:00
feat: 系统升级支持数据库自动迁移,避免手动执行升级脚本
This commit is contained in:
@@ -8,15 +8,15 @@ type Machine struct {
|
||||
model.Model
|
||||
model.ExtraData
|
||||
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Protocol int `json:"protocol"` // 连接协议 1.ssh 2.rdp
|
||||
Ip string `json:"ip"` // IP地址
|
||||
Port int `json:"port"` // 端口号
|
||||
Status int8 `json:"status"` // 状态 1:启用;2:停用
|
||||
Remark string `json:"remark"` // 备注
|
||||
SshTunnelMachineId int `json:"sshTunnelMachineId"` // ssh隧道机器id
|
||||
EnableRecorder int8 `json:"enableRecorder"` // 是否启用终端回放记录
|
||||
Code string `json:"code" gorm:"size:32;comment:code"` // code
|
||||
Name string `json:"name" gorm:"size:32"` // 名称
|
||||
Protocol int `json:"protocol" gorm:"default:1;comment:连接协议 1.ssh 2.rdp"` // 连接协议 1.ssh 2.rdp
|
||||
Ip string `json:"ip" gorm:"not null;size:100;comment:IP地址"` // IP地址
|
||||
Port int `json:"port" gorm:"not null;comment:端口号"` // 端口号
|
||||
Status int8 `json:"status" gorm:"not null;default:1;comment:状态 1:启用;2:停用"` // 状态 1:启用;2:停用
|
||||
Remark string `json:"remark" gorm:"comment:备注"` // 备注
|
||||
SshTunnelMachineId int `json:"sshTunnelMachineId" gorm:"comment:ssh隧道机器id"` // ssh隧道机器id
|
||||
EnableRecorder int8 `json:"enableRecorder" gorm:"comment:是否启用终端回放记录"` // 是否启用终端回放记录
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"mayfly-go/pkg/model"
|
||||
)
|
||||
|
||||
// 机器命令过滤配置
|
||||
// MachineCmdConf 机器命令过滤配置
|
||||
type MachineCmdConf struct {
|
||||
model.Model
|
||||
|
||||
Name string `json:"name"`
|
||||
Cmds model.Slice[string] `json:"cmds"` // 命令配置
|
||||
Status int8 `json:"execCmds"` // 状态
|
||||
Stratege string `json:"stratege"` // 策略,空禁用
|
||||
Remark string `json:"remark"` // 备注
|
||||
Name string `json:"name" gorm:"size:100;comment:名称"` // 名称
|
||||
Cmds model.Slice[string] `json:"cmds" gorm:"type:varchar(500);comment:命令配置"` // 命令配置
|
||||
Status int8 `json:"status" gorm:"comment:状态"` // 状态
|
||||
Stratege string `json:"stratege" gorm:"size:100;comment:策略"` // 策略,空禁用
|
||||
Remark string `json:"remark" gorm:"size:50;comment:备注"` // 备注
|
||||
}
|
||||
|
||||
@@ -9,24 +9,24 @@ import (
|
||||
type MachineCronJob struct {
|
||||
model.Model
|
||||
|
||||
Name string `json:"name" form:"name"`
|
||||
Key string `json:"key"`
|
||||
Cron string `json:"cron"` // cron表达式
|
||||
Script string `json:"script"` // 任务内容
|
||||
Status int `json:"status" form:"status"`
|
||||
Remark string `json:"remark"` // 备注
|
||||
LastExecTime *time.Time `json:"lastExecTime"`
|
||||
SaveExecResType int `json:"saveExecResType"` // 记录执行结果类型
|
||||
Name string `json:"name" form:"name" gorm:"not null;size:255;comment:名称"` // 名称
|
||||
Key string `json:"key" gorm:"not null;size:32;comment:key"` // key
|
||||
Cron string `json:"cron" gorm:"not null;size:255;comment:cron表达式"` // cron表达式
|
||||
Script string `json:"script" gorm:"type:text;comment:脚本内容"` // 任务内容
|
||||
Status int `json:"status" form:"status" gorm:"comment:状态"` // 状态
|
||||
Remark string `json:"remark" gorm:"size:255;comment:备注"` // 备注
|
||||
LastExecTime *time.Time `json:"lastExecTime" gorm:"comment:最后执行时间"` // 最后执行时间
|
||||
SaveExecResType int `json:"saveExecResType" gorm:"comment:保存执行记录类型"` // 记录执行结果类型
|
||||
}
|
||||
|
||||
// 机器任务执行记录
|
||||
// MachineCronJobExec 机器任务执行记录
|
||||
type MachineCronJobExec struct {
|
||||
model.DeletedModel
|
||||
|
||||
CronJobId uint64 `json:"cronJobId" form:"cronJobId"`
|
||||
MachineCode string `json:"machineCode" form:"machineCode"`
|
||||
Status int `json:"status" form:"status"` // 执行状态
|
||||
Res string `json:"res"` // 执行结果
|
||||
CronJobId uint64 `json:"cronJobId" form:"cronJobId" gorm:"not null;"`
|
||||
MachineCode string `json:"machineCode" form:"machineCode" gorm:"size:50;"`
|
||||
Status int `json:"status" form:"status"` // 执行状态
|
||||
Res string `json:"res" gorm:"size:4000;"` // 执行结果
|
||||
ExecTime time.Time `json:"execTime"`
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,8 @@ import "mayfly-go/pkg/model"
|
||||
type MachineFile struct {
|
||||
model.Model
|
||||
|
||||
Name string `json:"name"`
|
||||
// 机器id
|
||||
MachineId uint64 `json:"machineId"`
|
||||
Type int `json:"type"`
|
||||
// 路径
|
||||
Path string `json:"path"`
|
||||
Name string `json:"name" gorm:"not null;size:50;comment:机器文件配置(linux一切皆文件,故也可以表示目录)"` // 机器文件配置(linux一切皆文件,故也可以表示目录)
|
||||
MachineId uint64 `json:"machineId" gorm:"not null;comment:机器id"` // 机器id
|
||||
Type string `json:"type" gorm:"not null;size:32;comment:1:目录;2:文件"` // 1:目录;2:文件
|
||||
Path string `json:"path" gorm:"not null;size:150;comment:路径"` // 路径
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ import "mayfly-go/pkg/model"
|
||||
|
||||
type MachineScript struct {
|
||||
model.Model
|
||||
Name string `json:"name"`
|
||||
MachineId uint64 `json:"machineId"` // 机器id
|
||||
Type int `json:"type"`
|
||||
Description string `json:"description"` // 脚本描述
|
||||
Params string `json:"params"` // 参数列表json
|
||||
Script string `json:"script" gorm:"column:script;type:text"` // 脚本内容
|
||||
|
||||
Name string `json:"name" gorm:"not null;size:255;comment:脚本名"` // 脚本名
|
||||
MachineId uint64 `json:"machineId" gorm:"not null;comment:机器id[0:公共]"` // 机器id
|
||||
Type int `json:"type" gorm:"comment:脚本类型[1: 有结果;2:无结果;3:实时交互]"` // 脚本类型[1: 有结果;2:无结果;3:实时交互]
|
||||
Description string `json:"description" gorm:"size:255;comment:脚本描述"` // 脚本描述
|
||||
Params string `json:"params" gorm:"size:500;comment:脚本入参"` // 参数列表json
|
||||
Script string `json:"script" gorm:"type:text;comment:脚本内容"` // 脚本内容
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ import (
|
||||
type MachineTermOp struct {
|
||||
model.DeletedModel
|
||||
|
||||
MachineId uint64 `json:"machineId"`
|
||||
Username string `json:"username"`
|
||||
FileKey string `json:"fileKey"` // 文件key
|
||||
ExecCmds string `json:"execCmds"` // 执行的命令
|
||||
MachineId uint64 `json:"machineId" gorm:"not null;comment:机器id"` // 机器id
|
||||
Username string `json:"username" gorm:"size:60;comment:登录用户名"` // 登录用户名
|
||||
FileKey string `json:"fileKey" gorm:"size:36;comment:文件"` // 文件key
|
||||
ExecCmds string `json:"execCmds" gorm:"type:text;comment:执行的命令记录"` // 执行的命令
|
||||
|
||||
CreateTime *time.Time `json:"createTime"`
|
||||
CreatorId uint64 `json:"creatorId"`
|
||||
Creator string `json:"creator"`
|
||||
EndTime *time.Time `json:"endTime"`
|
||||
CreateTime *time.Time `json:"createTime" gorm:"not null;comment:创建时间"` // 创建时间
|
||||
CreatorId uint64 `json:"creatorId" gorm:"comment:创建人ID"`
|
||||
Creator string `json:"creator" gorm:"size:50;comment:创建人"` // 创建人
|
||||
EndTime *time.Time `json:"endTime" gorm:"comment:结束时间"` // 结束时间
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user